Nethereum.Blazor.Solidity 7.1.0

Prefix Reserved
dotnet add package Nethereum.Blazor.Solidity --version 7.1.0
                    
NuGet\Install-Package Nethereum.Blazor.Solidity -Version 7.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Nethereum.Blazor.Solidity" Version="7.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nethereum.Blazor.Solidity" Version="7.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Nethereum.Blazor.Solidity" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Nethereum.Blazor.Solidity --version 7.1.0
                    
#r "nuget: Nethereum.Blazor.Solidity, 7.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Nethereum.Blazor.Solidity@7.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Nethereum.Blazor.Solidity&version=7.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Nethereum.Blazor.Solidity&version=7.1.0
                    
Install as a Cake Tool

Nethereum.Blazor.Solidity

Blazor components for EVM transaction debugging with Solidity source mapping, step-through execution, and Monaco editor integration.

Overview

Nethereum.Blazor.Solidity provides an interactive EVM debugger for Blazor Server applications. It replays Ethereum transactions through the Nethereum EVM simulator (or via debug_traceTransaction RPC), matches deployed bytecode to Solidity source files, and presents a step-through debugging experience with source highlighting, stack/memory/storage inspection, and opcode-level navigation.

Key Features

  • EvmDebugger composite component with control bar, opcode list, source panel, and state panel
  • IEvmDebugService / EvmDebugService replays transactions via EVM simulation with fallback to debug_traceTransaction opcode tracer
  • Source map matching via FileSystemABIInfoStorage.FindABIInfoByRuntimeBytecode() for automatic Solidity file discovery
  • SolidityCodeViewer wraps the Monaco editor via JavaScript interop for syntax-highlighted source display with line highlighting
  • Step controls: start, end, step forward/back, next/previous source line, go-to-step
  • State inspection tabs: Stack, Memory (32-byte chunks), Storage (key/value pairs), Call Info (contract, caller, depth, gas, opcode, decoded parameters)
  • AddSolidityDebugger() DI extension for service registration

Installation

dotnet add package Nethereum.Blazor.Solidity

Targets net10.0.

Dependencies

  • Nethereum.EVM - EVMDebuggerSession, ProgramTrace, ProgramInstructionsUtils for EVM simulation and trace stepping
  • Nethereum.Web3 - RPC client for debug_traceTransaction fallback and transaction/receipt retrieval

Quick Start

1. Register Services

using Nethereum.Blazor.Solidity;

builder.Services.AddSolidityDebugger();

This registers IEvmDebugService as a scoped EvmDebugService.

2. Include Static Assets

In your _Host.cshtml or App.razor:

<script src="_content/Nethereum.Blazor.Solidity/solidity-monaco-interop.js"></script>

The Monaco editor is loaded from a CDN by the interop script.

3. Replay a Transaction and Render the Component

The IEvmDebugService replays the transaction and produces an EvmReplayResult. The EvmDebugger component renders that already-built session - it does not accept a transaction hash and does not replay.

@using Nethereum.Blazor.Solidity.Components
@using Nethereum.Blazor.Solidity.Services
@inject IEvmDebugService debugService

@if (result != null)
{
    <EvmDebugger Session="result.Session"
                 IsRevert="result.IsRevert"
                 HasSourceMaps="result.HasSourceMaps"
                 SourceFiles="result.SourceFiles"
                 FileContents="result.FileContents" />
}

@code {
    private EvmReplayResult result;
    private string txHash = "0xabc...";

    protected override async Task OnInitializedAsync()
    {
        result = await debugService.ReplayTransactionAsync(txHash);
    }
}

Components

EvmDebugger

Main composite component that orchestrates the debugging session. It renders an already-built session across four sub-components in a split layout; replaying a transaction into an EvmReplayResult is done by IEvmDebugService, whose result is passed into these parameters.

Parameters:

  • Session (EVMDebuggerSession, required) - The debugger session to render
  • IsRevert (bool) - Whether the replayed transaction reverted
  • HasSourceMaps (bool) - Whether Solidity source maps were matched
  • SourceFiles (List<string>) - Source file paths for the source panel
  • FileContents (Dictionary<string, string>) - Source file contents keyed by path
  • Theme (string?) - Monaco editor theme (defaults to nethereum-dark)

DebugControlBar

Navigation controls for stepping through execution trace.

  • GoToStart / GoToEnd - Jump to first or last trace step
  • StepBack / StepForward - Move one opcode at a time
  • PrevSourceLine / NextSourceLine - Jump to the next step that maps to a different source location
  • GoToInputStep - Jump to a specific step number

Displays the current step index, total steps, and current opcode.

DebugOpcodeList

Scrollable list of all opcodes in the execution trace. Each entry shows the program counter, opcode mnemonic, and gas cost. The current step is highlighted and auto-scrolled into view.

DebugSourcePanel

Displays Solidity source files with the current execution line highlighted. When multiple source files are involved (e.g., imported contracts), file tabs allow switching between them. Uses SolidityCodeViewer internally.

DebugStatePanel

Tabbed panel showing EVM state at the current execution step:

Tab Content
Stack Current stack values (top-down, hex-encoded)
Memory Memory contents displayed in 32-byte rows
Storage Key/value pairs written to storage at the current contract
Call Info Current contract address, caller, call depth, remaining gas, current opcode, and decoded function parameters

SolidityCodeViewer

Monaco editor wrapper via JavaScript interop (solidity-monaco-interop.js). Provides:

  • Solidity syntax highlighting
  • Read-only display mode
  • Line highlighting for current execution position
  • File registration and switching for multi-file debugging sessions

Services

IEvmDebugService

public interface IEvmDebugService
{
    bool IsAvailable { get; }
    Task<EvmReplayResult> ReplayTransactionAsync(string txHash);
}

EvmDebugService

Replays a transaction through the following pipeline:

  1. Fetches the transaction and receipt via eth_getTransactionByHash / eth_getTransactionReceipt
  2. Runs the transaction through EVMSimulator to produce a ProgramResult with full execution trace
  3. If a FileSystemABIInfoStorage is registered, calls its FindABIInfoByRuntimeBytecode() to match deployed bytecode against compiled artifacts
  4. When source maps are found, maps trace steps to Solidity source locations and loads source file contents
  5. Falls back to debug_traceTransaction (opcode tracer) when EVM simulation is not available
  6. Returns an EvmReplayResult containing the EVMDebuggerSession, step count, source files, and error information

EvmReplayResult

public class EvmReplayResult
{
    public EVMDebuggerSession Session { get; set; }
    public int TotalSteps { get; set; }
    public bool IsRevert { get; set; }
    public bool HasSourceMaps { get; set; }
    public string Error { get; set; }
    public List<string> SourceFiles { get; set; }
    public Dictionary<string, string> FileContents { get; set; }
}

Source Map Matching

The debugger automatically discovers Solidity source files when an ABI output directory is provided (e.g., Forge's out/ or Hardhat's artifacts/). The matching process:

  1. FileSystemABIInfoStorage scans the directory for *.json compiled contract artifacts (Foundry-style deployedBytecode.object / sourceMap) and for build-info files (standard JSON output with evm.deployedBytecode)
  2. For each contract in the trace, the deployed bytecode is compared against the stored artifacts
  3. When a match is found, the source map and source file paths from the compilation output are used to map program counter values to source locations
  4. Source files are loaded and displayed in the DebugSourcePanel

This works with Foundry artifacts and build-info standard JSON output.

Dependencies

  • Nethereum.EVM - EVM simulator, debugger session, and trace infrastructure
  • Nethereum.Web3 - RPC client for transaction retrieval and debug tracing

See Also

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Nethereum.Blazor.Solidity:

Package Downloads
Nethereum.Explorer

Nethereum.Explorer Blazor Server blockchain explorer component library for Ethereum-compatible chains. Provides pages for blocks, transactions, accounts, contracts, logs, token transfers, and MUD worlds with ABI decoding, contract interaction, and transaction tracing.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
7.1.0 74 11/10/2026
7.0.0 158 10/2/2026
6.1.0 204 3/25/2026
6.0.4 151 3/18/2026
6.0.3 139 3/18/2026
6.0.1 187 3/17/2026
6.0.0 161 3/16/2026