Skip to content

Nethereum/Nethereum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2,547 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nethereum

Documentation NuGet version Discord

Nethereum is the .NET integration platform for Ethereum and EVM-compatible blockchains. It provides a complete development stack — from smart contract interaction and transaction signing, through a full EVM simulator and in-process Ethereum node, to blockchain data indexing, an ERC-4337 account abstraction bundler, a Blazor blockchain explorer, MUD framework support, multi-platform wallet UIs, Unity game integration, and .NET Aspire orchestration. Nethereum targets netstandard 2.0 through .NET 10, .NET Framework 4.5.1+, and Unity, running on Windows, Linux, macOS, Android, iOS, WebAssembly, and game consoles.

Try Nethereum in Your Browser

Go to playground.nethereum.com to browse and execute samples directly in your browser — no setup required.

Nethereum Playground

Quick Start

dotnet add package Nethereum.Web3

Get an account balance

var web3 = new Web3("https://mainnet.infura.io/v3/YOUR_API_KEY");
var balance = await web3.Eth.GetBalance.SendRequestAsync("0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae");
Console.WriteLine($"Balance: {Web3.Convert.FromWei(balance.Value)} ETH");

Transfer ETH

var account = new Account("YOUR_PRIVATE_KEY");
var web3 = new Web3(account, "https://mainnet.infura.io/v3/YOUR_API_KEY");

var receipt = await web3.Eth.GetEtherTransferService()
    .TransferEtherAndWaitForReceiptAsync("0xRecipientAddress", 0.01m);

Interact with a smart contract

// Use code-generated typed services (see Code Generation below)
var transferHandler = web3.Eth.GetContractTransactionHandler<TransferFunction>();
var receipt = await transferHandler.SendRequestAndWaitForReceiptAsync(contractAddress,
    new TransferFunction { To = recipientAddress, Value = amount });

What You Can Build

Nethereum includes 130+ packages organised into focused libraries. Every row below links to a how-to guide on the documentation site.

I want to... Guide
Query ETH, ERC-20, ERC-721, and ERC-1155 balances (built-in typed services, no ABI needed) Query Balance
Send ETH (gas, nonce, EIP-1559 fees — all automatic) Transfer Ether
Send a transaction with custom data or fees Send Transactions
Delegate an EOA to a smart contract (EIP-7702) EIP-7702
Query blocks, transactions, and receipts Query Blocks
Estimate and customize gas fees Fee Estimation
Replace or speed up a pending transaction Transaction Replacement
Decode function calls from transaction input data Decode Transactions
ABI encode/decode (abi.encode, abi.encodePacked, EIP-712) ABI Encoding
Stream real-time data (new blocks, pending txns, event logs) Real-Time Streaming
I want to... Guide
Generate keys and create accounts Keys & Accounts
Sign and verify messages Message Signing
Sign EIP-712 typed structured data EIP-712 Signing
Use HD wallets (BIP32/BIP39 mnemonic) HD Wallets
Sign with Ledger or Trezor hardware wallets Hardware Wallets
Sign with AWS KMS or Azure Key Vault Cloud KMS
I want to... Guide
Deploy, call, and send transactions to contracts Smart Contract Interaction
Work with ERC-20 tokens (balance, transfer, approve) ERC-20 Tokens
Generate C# services from Solidity ABI Code Generation
Filter and query contract events Events
Batch queries with Multicall or RPC batching Multicall
Deploy to deterministic addresses with CREATE2 CREATE2
I want to... Guide
Simulate a transaction and preview state changes Transaction Simulation
Debug EVM execution step-by-step (opcodes, stack, storage) EVM Debugging
Decode nested call trees (contract-to-contract calls) Call Tree Decoding
Simulate ERC-20 transfers and approvals ERC-20 Simulation
Execute and disassemble raw bytecode Bytecode Execution
I want to... Guide
Run a local dev chain (no external node needed) DevChain Quickstart
Fork a live network and manipulate state/time Forking & State
Trace and debug transactions (opcode-level) Debug & Trace
Spin up a full dev environment with Aspire (DevChain + PostgreSQL + Indexer + Explorer) dotnet new nethereum-devchain
I want to... Guide
Swap tokens on Uniswap (V2/V3/V4) Uniswap Swap
Manage Uniswap liquidity positions Uniswap Liquidity
Execute Gnosis Safe multi-sig transactions Gnosis Safe
Accept or pay for crypto payments (x402) x402 Payments
I want to... Guide
Create and send a UserOperation Send UserOperation
Deploy a smart account Smart Account Deployment
Batch operations and use paymasters Batching & Paymasters
Use ERC-7579 modular accounts (validators, hooks, session keys) Modular Accounts
Run an ERC-4337 bundler Run Bundler
I want to... Guide
Index blockchain data to PostgreSQL / SQL Server / SQLite Database Storage
Index ERC-20/721/1155 token transfers and balances Token Indexing
Build a blockchain explorer (ABI decoding, token pages, contract interaction) Blockchain Explorer
Scan token balances via multicall (no indexer needed) Token Portfolio
Fetch ABI from Sourcify or Etherscan ABI Retrieval
Get token prices and metadata (CoinGecko) CoinGecko API
I want to... Guide
Read, write, and query MUD table records MUD Tables
Index MUD Store events to PostgreSQL MUD Indexing
Deploy a MUD World with tables and systems MUD Deployment
I want to... Guide
Build a multi-platform wallet app (Blazor, MAUI, Avalonia) Wallet Quickstart
Create accounts (mnemonic, private key, vault encryption) Wallet Accounts
Connect browser wallets in Blazor (EIP-6963 discovery) Blazor Wallet Connect
Authenticate with Sign-In with Ethereum (SIWE) Blazor Authentication
Interact with any contract dynamically (no codegen) Blazor Contract Interaction
Build Unity games with Ethereum Unity Quickstart
I want to... Guide
Verify ETH balances without trusting RPC Verified State
Track finalized beacon headers via light client Light Client
I want to... Guide
Launch a sequencer and deploy contracts AppChain Quickstart
Use AppChainBuilder for embedded/testing AppChain Quickstart
Configure RocksDB persistent storage AppChain Storage
Sync follower nodes and verify state AppChain Sync

For the full list of 100+ use cases with packages, see What Do You Want to Do? on the documentation site.

Code Generation

Generate typed C# contract services directly from Solidity ABI using the VS Code Solidity extension or the CLI tool:

Code generation of Contract Definitions

dotnet tool install -g Nethereum.Generator.Console

This generates typed service classes, function/event DTOs, deployment messages, and optionally Blazor UI components and MUD table services.

Templates

Nethereum.Templates.Pack

The templates pack provides ready-to-use project templates for smart contract development, Blazor integration, and authentication.

dotnet new install Nethereum.Templates.Pack
Template Short Name Description
Smart Contract Library + ERC20 XUnit smartcontract Smart contract library with ERC20 example, auto code generation, and integration tests
ERC721/ERC1155 Open Zeppelin + XUnit nethereum-erc721-oz NFT and multi-token development with OpenZeppelin
Blazor Metamask Wasm/Server nethereum-mm-blazor Blazor integration with MetaMask (Wasm and Server)
Blazor SIWE Wasm/Server/REST API nethereum-siwe Sign-In with Ethereum authentication
WebSocket Streaming nethereum-ws-stream Real-time blockchain data streaming

Source and details: Nethereum.Templates.SmartContractDefault, Nethereum.Templates.SmartContracts.OZ-Erc721-Erc1155, Nethereum.Templates.Metamask.Blazor, Nethereum.Templates.Siwe

Nethereum.DevChain.Template (.NET Aspire)

Spin up a complete Ethereum development environment with a single command:

dotnet new install Nethereum.DevChain.Template
dotnet new nethereum-devchain -n MyChain
cd MyChain/AppHost && dotnet run

This creates an Aspire-orchestrated solution with a DevChain node, PostgreSQL database, blockchain indexer (blocks, transactions, tokens, MUD), and a Blazor blockchain explorer — all wired with service discovery, health checks, and OpenTelemetry.

Wallets & End-to-End Examples

Project Description
Explorer Wallet (Blazor/MAUI) Blazor Wasm SPA, Desktop, Android, iOS — light explorer and wallet. Try it live
Desktop Wallet (Avalonia) Cross-platform desktop wallet with ReactiveUI
Unity3d Sample Template Unity starter — balance query, ERC20, MetaMask, cross-platform
Unity WebGL + MetaMask Deploy and interact with ERC721 NFTs from Unity WebGL
Nethereum Flappy Unity game integrating with Ethereum

Unity libraries: install via Nethereum.Unity (git URL) or from src/compiledlibraries/ in each GitHub release. Try samples in the Nethereum Playground.

More Examples

Demos (src/demos/):

Console Examples (consoletests/):

Supported Platforms

Target Scope
netstandard 2.0, net451, net461, net6.0, net8.0, net9.0, net10.0 Core libraries
net8.0, net10.0 CoreChain, AppChain, Server components
net6.0–net10.0 Blazor UI
net461, net472, netstandard 2.1 Unity

Compatible with Windows, Linux, macOS, Android, iOS, WebAssembly, and game consoles.

Full Component Catalog

For a complete guide covering all 130+ packages organised by use case — with package names, descriptions, and links to individual READMEs — see the Component Catalog or What Do You Want to Do?.

Documentation & Community

Thanks and Credits

Building Nethereum has been a journey of over ten years, and it would not exist without the incredible people and community around it.

First and foremost, thank you to my family for their patience, support, and understanding through countless late nights, weekends, and "just one more commit" moments. You made this possible.

Thank you to Cass (@c055) for the fantastic Nethereum logo, recreating one of the @ethereumjs logo ideas for our project.

To all my friends across the Ethereum ecosystem — the people I've met at conferences, hackathons, online chats, and working groups over the years. The friendships built through this shared passion for decentralised technology have been one of the most rewarding parts of the journey.

A special thank you to Gael, Dave, Kevin, Caleb, Aaron, and Eva for their help and work on Nethereum — your contributions have been invaluable.

To every contributor who has ever submitted a pull request, reported a bug, suggested a feature, or simply asked a question on GitHub, Discord, or Gitter — you are continuously shaping this project. Every issue filed, every piece of feedback, every "it doesn't work when..." has made Nethereum better.

To the early adopters who believed in Nethereum when it was just getting started and provided invaluable feedback — your trust and patience in those early days meant everything.

To the teams and projects I've had the privilege of collaborating with and trying to help over the years — from enterprise pilots to startup MVPs, from gaming studios to DeFi protocols. Seeing Nethereum used in real-world applications is the ultimate motivation.

To everyone building the Ethereum ecosystem — the client teams (Geth, Besu, Nethermind, Erigon, Reth), the compiler teams (Solidity, Vyper), the tooling teams (Foundry, Hardhat, Remix), the library builders (web3.js, ethers.js, web3j, web3.py), the L2 teams, the researchers, the standard authors, and everyone else pushing this technology forward. We all build on each other's work.

To Consensys, the Ethereum Foundation, and the broader blockchain community for fostering an environment where open-source collaboration thrives.

And to everyone who continues to help, contribute, encourage, and inspire — directly or indirectly. The best is yet to come.