Nethereum.Geth 5.8.0

Prefix Reserved
dotnet add package Nethereum.Geth --version 5.8.0
                    
NuGet\Install-Package Nethereum.Geth -Version 5.8.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.Geth" Version="5.8.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nethereum.Geth" Version="5.8.0" />
                    
Directory.Packages.props
<PackageReference Include="Nethereum.Geth" />
                    
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.Geth --version 5.8.0
                    
#r "nuget: Nethereum.Geth, 5.8.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.Geth@5.8.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.Geth&version=5.8.0
                    
Install as a Cake Addin
#tool nuget:?package=Nethereum.Geth&version=5.8.0
                    
Install as a Cake Tool

Nethereum.Geth

Extended Web3 library for Go Ethereum (Geth) client. Provides RPC client methods for Admin, Debug, Miner, TxnPool, and Geth-specific Eth APIs.

Overview

Nethereum.Geth extends Nethereum.Web3 with Geth-specific JSON-RPC methods. Use Web3Geth instead of Web3 to access additional APIs for node administration, transaction tracing, mining control, and mempool inspection.

API Services:

  • Admin - Peer management, RPC/HTTP/WS server control, chain import/export
  • Debug - Transaction and block tracing, profiling, memory/garbage collection stats
  • Miner - Mining control (start, stop, set gas price)
  • TxnPool - Transaction pool inspection (status, content)
  • GethEth - Geth-specific eth methods (pending transactions, eth_call with state overrides)

Installation

dotnet add package Nethereum.Geth

Or via Package Manager Console:

Install-Package Nethereum.Geth

Dependencies

Package References:

  • Nethereum.RPC
  • Nethereum.Web3

Usage

Web3Geth Initialization

Replace Web3 with Web3Geth:

using Nethereum.Geth;

var web3 = new Web3Geth("http://localhost:8545");

With account:

using Nethereum.Geth;
using Nethereum.Web3.Accounts;

var account = new Account("PRIVATE_KEY");
var web3 = new Web3Geth(account, "http://localhost:8545");

From: src/Nethereum.Geth/Web3Geth.cs:10

Admin API

Manage node peers, RPC/HTTP/WS servers, and chain data.

Check Connected Peers

var peers = await web3.Admin.Peers.SendRequestAsync();
Console.WriteLine($"Connected peers: {peers.Count}");

From: tests/Nethereum.Geth.IntegrationTests/Testers/AdminPeersTester.cs:18

Add Peer

var enode = "enode://pubkey@ip:port";
var result = await web3.Admin.AddPeer.SendRequestAsync(enode);

From: src/Nethereum.Geth/RPC/Admin/AdminAddPeer.cs

Get Node Info

var nodeInfo = await web3.Admin.NodeInfo.SendRequestAsync();

From: src/Nethereum.Geth/IAdminApiService.cs:16

Start/Stop RPC Server

// Start RPC server
var started = await web3.Admin.StartRPC.SendRequestAsync("localhost", 8545, "*", "web3,eth,net");

// Stop RPC server
var stopped = await web3.Admin.StopRPC.SendRequestAsync();

From: src/Nethereum.Geth/IAdminApiService.cs:17-19

Export/Import Chain

// Export chain to file
var exported = await web3.Admin.ExportChain.SendRequestAsync("/path/to/export.rlp");

// Import chain from file
var imported = await web3.Admin.ImportChain.SendRequestAsync("/path/to/chain.rlp");

From: src/Nethereum.Geth/IAdminApiService.cs:13-14

Debug API

Transaction and block tracing, profiling, memory statistics.

Trace Transaction

using Nethereum.Geth.RPC.Debug.DTOs;
using Newtonsoft.Json.Linq;

var txHash = "0x...";
var tracingOptions = new TracingOptions();
var trace = await web3.GethDebug.TraceTransaction.SendRequestAsync<JToken>(txHash, tracingOptions);

From: tests/Nethereum.Geth.IntegrationTests/Testers/DebugTraceTransactionTester.cs:36

Trace Transaction with Tracers

Geth supports built-in tracers for structured transaction analysis.

Call Tracer:

using Nethereum.Geth.RPC.Debug.Tracers;

var trace = await web3.GethDebug.TraceTransaction.SendRequestAsync<CallTracerResponse>(
    txHash,
    new TracingOptions
    {
        Timeout = "1m",
        Reexec = 128,
        TracerInfo = new CallTracerInfo(onlyTopCalls: false, withLogs: true)
    });

From: tests/Nethereum.Geth.IntegrationTests/Testers/DebugTraceTransactionTester.cs:75

4Byte Tracer (function selector frequency):

var trace = await web3.GethDebug.TraceTransaction.SendRequestAsync<FourByteTracerResponse>(
    txHash,
    new TracingOptions
    {
        Timeout = "1m",
        Reexec = 128,
        TracerInfo = new FourByteTracerInfo()
    });

From: tests/Nethereum.Geth.IntegrationTests/Testers/DebugTraceTransactionTester.cs:89

Opcode Tracer (EVM opcode execution):

var trace = await web3.GethDebug.TraceTransaction.SendRequestAsync<OpcodeTracerResponse>(
    txHash,
    new TracingOptions
    {
        Timeout = "1m",
        Reexec = 128,
        TracerInfo = new OpcodeTracerInfo(
            enableMemory: true,
            disableStack: false,
            disableStorage: false,
            enableReturnData: true,
            debug: false,
            limit: 10)
    });

From: tests/Nethereum.Geth.IntegrationTests/Testers/DebugTraceTransactionTester.cs:166

Prestate Tracer (account state before execution):

// Prestate mode
var prestateTrace = await web3.GethDebug.TraceTransaction.SendRequestAsync<PrestateTracerResponsePrestateMode>(
    txHash,
    new TracingOptions
    {
        Timeout = "1m",
        Reexec = 128,
        TracerInfo = new PrestateTracerInfo(diffMode: false)
    });

// Diff mode
var diffTrace = await web3.GethDebug.TraceTransaction.SendRequestAsync<PrestateTracerResponseDiffMode>(
    txHash,
    new TracingOptions
    {
        Timeout = "1m",
        Reexec = 128,
        TracerInfo = new PrestateTracerInfo(diffMode: true)
    });

From: tests/Nethereum.Geth.IntegrationTests/Testers/DebugTraceTransactionTester.cs:180

Additional Tracers:

  • UnigramTracerInfo - Opcode frequency (single opcodes)
  • BigramTracerInfo - Opcode pairs frequency
  • TrigramTracerInfo - Opcode triples frequency
  • OpcountTracerInfo - Total opcode count

From: tests/Nethereum.Geth.IntegrationTests/Testers/DebugTraceTransactionTester.cs:115-140

Trace Block

var blockNumber = new Nethereum.Hex.HexTypes.HexBigInteger(12345);
var blockTrace = await web3.GethDebug.TraceBlockByNumber.SendRequestAsync(blockNumber, tracingOptions);

From: src/Nethereum.Geth/IDebugApiService.cs:25

Custom JavaScript Tracer

var customTracerCode = @"{
    data: [],
    fault: function(log) {},
    step: function(log) { this.data.push(log.op.toString()); },
    result: function() { return this.data; }
}";

var trace = await web3.GethDebug.TraceTransaction.SendRequestAsync<JToken>(
    txHash,
    new TracingOptions
    {
        Timeout = "1m",
        Reexec = 128,
        TracerInfo = new CustomTracerInfo(customTracerCode)
    });

From: tests/Nethereum.Geth.IntegrationTests/Testers/DebugTraceTransactionTester.cs:205

Get Memory Stats

var memStats = await web3.GethDebug.MemStats.SendRequestAsync();

From: src/Nethereum.Geth/IDebugApiService.cs:14

Get Block RLP

var blockNumber = new Nethereum.Hex.HexTypes.HexBigInteger(100);
var rlp = await web3.GethDebug.GetBlockRlp.SendRequestAsync(blockNumber);

From: src/Nethereum.Geth/IDebugApiService.cs:12

CPU Profiling

// Start CPU profiling
await web3.GethDebug.StartCPUProfile.SendRequestAsync("/path/to/profile.prof");

// Stop profiling
await web3.GethDebug.StopCPUProfile.SendRequestAsync();

From: src/Nethereum.Geth/IDebugApiService.cs:19-21

Miner API

Control mining operations.

Start Mining

// Start with 1 thread (argument is optional, default is 1)
var result = await web3.Miner.Start.SendRequestAsync();

From: tests/Nethereum.Geth.IntegrationTests/Testers/MinerStartTester.cs:16

Stop Mining

var result = await web3.Miner.Stop.SendRequestAsync();

From: src/Nethereum.Geth/RPC/Miner/MinerStop.cs

Set Gas Price

using Nethereum.Hex.HexTypes;

var gasPrice = new HexBigInteger(1000000000); // 1 gwei
var result = await web3.Miner.SetGasPrice.SendRequestAsync(gasPrice);

From: src/Nethereum.Geth/RPC/Miner/MinerSetGasPrice.cs

TxnPool API

Inspect transaction pool (mempool).

Get Pool Status

var status = await web3.TxnPool.PoolStatus.SendRequestAsync();

From: src/Nethereum.Geth/ITxnPoolApiService.cs:9

Get Pool Content

var content = await web3.TxnPool.PoolContent.SendRequestAsync();

From: src/Nethereum.Geth/ITxnPoolApiService.cs:7

Inspect Pool

var inspect = await web3.TxnPool.PoolInspect.SendRequestAsync();

From: src/Nethereum.Geth/ITxnPoolApiService.cs:8

GethEth API

Geth-specific eth methods.

Get Pending Transactions

var pendingTxs = await web3.GethEth.PendingTransactions.SendRequestAsync();

From: src/Nethereum.Geth/IGethEthApiService.cs:7

eth_call with State Overrides

Execute contract call with temporary state modifications (e.g., replace contract code, override balances).

using Nethereum.RPC.Eth.DTOs;
using System.Collections.Generic;

var stateChanges = new Dictionary<string, StateChange>
{
    ["0xContractAddress"] = new StateChange
    {
        Code = "0x6080604052..." // Override contract code
    }
};

var result = await web3.GethEth.Call.SendRequestAsync(
    new CallInput
    {
        To = "0xContractAddress",
        Data = "0x893d20e8" // Function selector
    },
    BlockParameter.CreateLatest(),
    stateChanges);

From: tests/Nethereum.Contracts.IntegrationTests/SmartContracts/GethCallTest.cs:39

VM Stack Error Checking

Analyze VM execution traces for errors.

var stackErrorChecker = web3.GethDebug.StackErrorChecker;
// Use with trace results to detect stack errors

From: src/Nethereum.Geth/IDebugApiService.cs:17

Admin API Service

Interface: IAdminApiService (src/Nethereum.Geth/IAdminApiService.cs:5)

Method RPC Method Description
AddPeer admin_addPeer Add peer by enode URL
RemovePeer admin_removePeer Remove peer
AddTrustedPeer admin_addTrustedPeer Add trusted peer
RemoveTrustedPeer admin_removeTrustedPeer Remove trusted peer
Peers admin_peers List connected peers
NodeInfo admin_nodeInfo Get node information
Datadir admin_datadir Get data directory path
StartRPC admin_startRPC Start RPC server
StopRPC admin_stopRPC Stop RPC server
StartHTTP admin_startHTTP Start HTTP server
StopHTTP admin_stopHTTP Stop HTTP server
StartWS admin_startWS Start WebSocket server
StopWS admin_stopWS Stop WebSocket server
ExportChain admin_exportChain Export blockchain to file
ImportChain admin_importChain Import blockchain from file

Debug API Service

Interface: IDebugApiService (src/Nethereum.Geth/IDebugApiService.cs:5)

Method RPC Method Description
TraceTransaction debug_traceTransaction Trace transaction execution
TraceBlock debug_traceBlock Trace all transactions in block
TraceBlockByNumber debug_traceBlockByNumber Trace block by number
TraceBlockByHash debug_traceBlockByHash Trace block by hash
TraceBlockFromFile debug_traceBlockFromFile Trace block from RLP file
TraceCall debug_traceCall Trace eth_call execution
GetBlockRlp debug_getBlockRlp Get RLP-encoded block
DumpBlock debug_dumpBlock Dump block state
SeedHash debug_seedHash Get PoW seed hash
BacktraceAt debug_backtraceAt Set logging backtrace location
Verbosity debug_verbosity Set logging verbosity
Vmodule debug_vmodule Set per-module verbosity
Stacks debug_stacks Get goroutine stack traces
MemStats debug_memStats Get memory allocation statistics
GcStats debug_gcStats Get garbage collection statistics
CpuProfile debug_cpuProfile Write CPU profile
StartCPUProfile debug_startCPUProfile Start CPU profiling
StopCPUProfile debug_stopCPUProfile Stop CPU profiling
StartGoTrace debug_startGoTrace Start Go execution trace
StopGoTrace debug_stopGoTrace Stop Go execution trace
BlockProfile debug_blockProfile Write goroutine blocking profile
SetBlockProfileRate debug_setBlockProfileRate Set blocking profile rate
GoTrace debug_goTrace Write Go execution trace

Miner API Service

Interface: IMinerApiService (src/Nethereum.Geth/IMinerApiService.cs:5)

Method RPC Method Description
Start miner_start Start mining
Stop miner_stop Stop mining
SetGasPrice miner_setGasPrice Set minimum gas price

TxnPool API Service

Interface: ITxnPoolApiService (src/Nethereum.Geth/ITxnPoolApiService.cs:5)

Method RPC Method Description
PoolStatus txpool_status Get transaction pool status (pending/queued counts)
PoolContent txpool_content Get full transaction pool content
PoolInspect txpool_inspect Get transaction pool summary

GethEth API Service

Interface: IGethEthApiService (src/Nethereum.Geth/IGethEthApiService.cs:5)

Method RPC Method Description
PendingTransactions eth_pendingTransactions Get pending transactions
Call eth_call Execute call with state overrides
  • Nethereum.Web3 - Base Web3 implementation
  • Nethereum.RPC - JSON-RPC client infrastructure
  • Nethereum.Besu - Hyperledger Besu-specific APIs
  • Nethereum.Parity - OpenEthereum/Parity-specific APIs

Additional Resources

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net451 is compatible.  net452 was computed.  net46 was computed.  net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Nethereum.Geth:

Package Downloads
Nethereum.Quorum

Nethereum.Quorum. Extension to interact with Quorum, the permissioned implementation of Ethereum supporting data privacy created by JP Morgan

ChainBroker

Package Description

Wonka.Eth

Relying heavily on the Nethereum project, this library contains classes that interact with the Ethereum foundation and that extend the Wonka engine, particulary the base class WonkaBizRulesEngine in the Wonka.BizRulesEngine library. With the funtionality provided here, Wonka becomes a business rules engine for both the .NET platform and the Ethereum platform, one that is inherently metadata-driven and serves as a reference implementation for EIP-2746. Once the rules are written into a markup language and are parsed/deserialized by the .NET form of the engine, these rules can then be serialized onto the blockchain using Nethereum, and stored within a smart contract (i.e., the Ethereum version of the engine) built using the Solidity language. The Ethereum version of this engine can also be deployed as a contract by this library. After providing a number of rules and populating a record, a user can submit the populated record for validation by the rules engine, whether it exists in .NET or the blockchain.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Nethereum.Geth:

Repository Stars
bizanc/Bizanc.io.Core
Bizanc Blockchain
Version Downloads Last Updated
5.8.0 508 1/6/2026
5.0.0 5,445 5/28/2025
4.29.0 6,575 2/10/2025
4.28.0 348 1/7/2025
4.27.1 327 12/24/2024
4.27.0 282 12/24/2024
4.26.0 594 10/1/2024
4.25.0 516 9/19/2024
4.21.4 484 8/9/2024
4.21.3 349 7/22/2024
4.21.2 2,047 6/26/2024
4.21.1 321 6/26/2024
4.21.0 349 6/18/2024
4.20.0 4,409 3/28/2024
4.19.0 529 2/16/2024
4.18.0 7,715 11/21/2023
4.17.1 1,472 9/28/2023
4.17.0 377 9/27/2023
4.16.0 1,496 8/14/2023
4.15.2 2,616 7/11/2023
Loading failed