Skip to main content

Data & Indexing

Nethereum provides a complete pipeline for crawling blockchain data, persisting it to relational databases, indexing token activity, and exploring the results through a Blazor UI. The stack is modular — use the processing engine alone for custom ETL, add database storage for persistence, layer on token indexing for ERC-20/721/1155 tracking, and embed the explorer for a ready-made UI.

What Can I Do?

I want to...GuidePackages
Crawl blocks and process transactionsBlockchain ProcessingNethereum.BlockchainProcessing
Process typed event logs from contractsBlockchain ProcessingNethereum.BlockchainProcessing
Track progress and resume after restartBlockchain ProcessingNethereum.BlockchainProcessing
Handle chain reorganisationsBlockchain ProcessingNethereum.BlockchainProcessing
Persist blocks/txs/logs to PostgreSQLDatabase StorageBlockchainStore.Postgres + Processors.Postgres
Persist to SQL Server or SQLiteDatabase StorageBlockchainStore.SqlServer/Sqlite + Processors
Run indexing as a hosted serviceDatabase StorageBlockchainStorage.Processors.*
Index internal transactions (traces)Database StorageProcessors.* + debug RPC
Index ERC-20 token transfersToken IndexingBlockchainStorage.Token.Postgres
Index ERC-721 NFT ownershipToken IndexingBlockchainStorage.Token.Postgres
Index ERC-1155 multi-token balancesToken IndexingBlockchainStorage.Token.Postgres
Build a blockchain explorerExplorerNethereum.Explorer
Interact with contracts via ABI-decoded UIExplorerNethereum.Explorer + DataServices
Debug EVM execution step-by-stepExplorerNethereum.Explorer
Browse MUD World tables in a UIExplorerNethereum.Explorer + Mud.Repositories.Postgres

Quick Start — Process Event Logs

var processor = web3.Processing.Logs.CreateProcessor<TransferEventDTO>(
action: log =>
{
Console.WriteLine($"Transfer: {log.Event.From} -> {log.Event.To}, Amount: {log.Event.Value}");
return Task.CompletedTask;
},
minimumBlockConfirmations: 12,
contractAddresses: new[] { contractAddress }
);

await processor.ExecuteAsync(
startAtBlockNumberIfNotProcessed: 18000000,
cancellationToken: cancellationToken.Token
);

The fastest way to get a running indexer + explorer is the Aspire template:

dotnet new install Nethereum.Aspire.TemplatePack
dotnet new nethereum-devchain -n MyExplorer
cd MyExplorer
dotnet run --project AppHost

This gives you DevChain + Indexer + Explorer + PostgreSQL, all orchestrated by .NET Aspire with service discovery. Open the Aspire dashboard to see all services running. See the Explorer guide for details.

Quick Start — Manual Setup (Indexer + Explorer)

var builder = WebApplication.CreateBuilder(args);
var conn = "Host=localhost;Database=blockchain;Username=postgres;Password=secret";

// Index blocks, transactions, logs
builder.Services.AddPostgresBlockchainProcessor(builder.Configuration, conn);
builder.Services.AddPostgresInternalTransactionProcessor();

// Index ERC-20/721/1155 tokens
builder.Services.AddTokenLogPostgresProcessing(builder.Configuration, conn);
builder.Services.AddTokenDenormalizerProcessing(builder.Configuration, conn);
builder.Services.AddTokenBalanceAggregationProcessing(builder.Configuration, conn);

// Blazor explorer UI
builder.Services.AddExplorerServices(builder.Configuration);

var app = builder.Build();
app.MapRazorComponents<App>().AddInteractiveServerRenderMode();
app.Run();

Architecture

BlockchainProcessing (pipeline engine)
├── BlockCrawlOrchestrator — block-by-block with txs, receipts, logs
├── LogOrchestrator — batch eth_getLogs across large ranges
└── InternalTransactionOrchestrator — debug_traceTransaction

BlockchainStore.EFCore (storage abstraction)
├── BlockchainDbContextBase — entity models, indexes
├── Repository interfaces — IBlockRepository, ITransactionRepository, etc.
└── Provider implementations — Postgres, SqlServer, Sqlite

BlockchainStorage.Processors (hosted services)
├── BlockchainProcessingHostedService — indexes blocks/txs/logs
└── InternalTransactionProcessingHostedService — indexes call traces

BlockchainStorage.Token.Postgres (token pipeline)
├── TokenLogPostgresProcessingService — capture Transfer events
├── TokenDenormalizerService — decode into typed records
└── TokenBalanceRpcAggregationService — aggregate balances via RPC

Nethereum.Explorer (Blazor UI)
├── Block/transaction/account/contract browsing
├── ABI-decoded contract interaction
├── Token balances, NFT inventory, transfers
├── EVM debugger with Solidity source mapping
└── MUD World browser

Database Providers

PackageProvider
Nethereum.BlockchainStore.PostgresPostgreSQL
Nethereum.BlockchainStore.SqlServerSQL Server
Nethereum.BlockchainStore.SqliteSQLite

Guides

  • Blockchain Processing — Crawl blocks, transactions, and event logs with progress tracking
  • Database Storage — Persist to PostgreSQL, SQL Server, or SQLite with hosted services
  • Token Indexing — Index ERC-20/721/1155 transfers and aggregate balances
  • Explorer — Embed a full-featured Blazor blockchain explorer