evm-simulation

Simulate Ethereum transactions and decode call trees, state changes, and revert reasons with Nethereum.EVM.

2.3k|744|Updated Nov 23, 2015
One-click install
npx skills add https://github.com/Nethereum/Nethereum --skill evm-simulation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: evm-simulation
Source: https://github.com/Nethereum/Nethereum/tree/main/plugins/nethereum-skills/skills/evm-simulation
Command: npx skills add https://github.com/Nethereum/Nethereum --skill evm-simulation

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires Nethereum.EVM, Nethereum.EVM.Contracts, Nethereum.Web3.

What problem does it solve?

Developers need to know what a transaction will do before signing or sending it on-chain. This Skill lets you execute Ethereum transactions locally against real blockchain state in .NET, previewing balance changes, decoding call trees, and diagnosing reverts without spending gas.

Core Features & Use Cases

  • Transaction Preview: Simulate a transaction and extract all balance changes (ETH, ERC-20, ERC-721, ERC-1155) before signing.
  • Call Tree & Event Decoding: Decode nested contract calls, function parameters, and emitted events into a readable structure.
  • Revert & Error Diagnosis: Decode custom errors, require messages, and panic codes to understand why a transaction fails.
  • Bytecode Analysis: Execute, debug, and disassemble EVM bytecode, including Solidity source-map debugging.
  • Use Case: Before submitting a DeFi swap, simulate it with TransactionExecutor against mainnet state, then use StateChangesExtractor to confirm the expected token amounts and detect fee-on-transfer tokens.

Quick Start

Ask the assistant to simulate an Ethereum transaction with Nethereum.EVM and show the resulting balance changes and decoded call tree.

Frequently Asked Questions about evm-simulation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I simulate an Ethereum transaction in C# before sending it?

Use Nethereum.EVM's TransactionExecutor with a TransactionExecutionContext configured with sender, calldata, gas limits, and block context from an RPC node. Set ExecutionMode.Call to simulate without gas payment, then decode results with ProgramResultDecoder.

How to preview token balance changes from a transaction in .NET?

Use StateChangesExtractor on the decoded simulation result to get BalanceChange entries for Native, ERC20, ERC721, and ERC1155 transfers. Each change includes the token address, amount, and validation status such as FeeOnTransfer detection.

Does Nethereum.EVM support decoding revert reasons and custom errors?

Yes, ProgramResultDecoder decodes failed executions into DecodedError objects containing the error ABI, parameters, and message. It handles custom errors, require messages, and panic codes when the error ABI is available in the ABI storage.

Can I disassemble and debug EVM bytecode with Nethereum?

Yes, ProgramInstructionsUtils disassembles bytecode into opcode listings and detects function signatures. EVMSimulator executes bytecode step by step, and EVMDebuggerSession supports interactive debugging with Solidity source maps.

What are the limitations of local EVM transaction simulation?

Simulation requires an RPC endpoint to fetch live blockchain state, so results reflect the state at the queried block only. It cannot predict mempool ordering, MEV effects, or state changes from transactions confirmed after the simulation block.