blockchain-indexing

Index Ethereum blocks, transactions, logs, and token data into relational databases with reorg handling.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Storing and querying on-chain data (blocks, transactions, event logs, token transfers) requires building a crawler that tracks progress, handles chain reorganisations, and persists data reliably — this Skill provides that full pipeline for .NET applications using Nethereum.

Core Features & Use Cases

  • Hosted Indexing Service: One-line DI setup registers a BackgroundService that continuously crawls an EVM chain and persists data to PostgreSQL, SQL Server, or SQLite via EF Core.
  • Event Log Crawling: Typed processors for ERC-20/ERC-721 Transfer events, contract-specific filters, and bulk historical event retrieval without full block processing.
  • Reorg Handling & Progress Tracking: Chain consistency validation, reorg buffers, IsCanonical flags, and pluggable progress repositories (JSON file, in-memory, or database-backed).
  • Use Case: Build a token analytics backend that indexes all USDC Transfer events from block 20,000,000 onward into Postgres, automatically rewinding and re-processing blocks when a chain reorg is detected.

Quick Start

Set up a hosted blockchain indexer that crawls an Ethereum RPC endpoint and stores blocks, transactions, and logs into a PostgreSQL database using Nethereum.

Frequently Asked Questions about blockchain-indexing

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

FAQPage Schema
How do I index Ethereum blockchain data into a database with .NET?

Use Nethereum's BlockchainProcessing pipeline with one of the EF Core store packages. Call AddPostgresBlockchainProcessor (or the SqlServer/Sqlite variant) with a connection string, configure BlockchainProcessing options like BlockchainUrl and FromBlock, and the hosted service crawls and persists blocks automatically.

How to crawl ERC-20 Transfer events for a specific contract in C#?

Use web3.Processing.Logs.CreateProcessorForContract<TransferEventDTO> with the contract address and a callback action. For bulk historical retrieval, call web3.Processing.Logs.ERC20.GetAllTransferEventsForContract with from and to block numbers.

Which databases does Nethereum blockchain storage support?

Nethereum BlockchainStore supports PostgreSQL, SQL Server, and SQLite through dedicated EF Core provider packages. Each has a one-call DI extension that wires up the context, processing options, and hosted indexing service.

How does the indexer handle chain reorganisations?

The pipeline uses a ReorgBuffer to re-process recent blocks each cycle and a ChainConsistencyValidator that checks parent hash continuity. On mismatch it throws ReorgDetectedException, rewinds progress, and marks affected blocks, transactions, and logs as non-canonical.

Can I track indexing progress across restarts?

Yes, via IBlockProgressRepository implementations. JsonBlockProgressRepository persists the last processed block to a JSON file, while database-backed factories store progress alongside block data, so indexing resumes from the correct height after a restart.

What are the limitations of log-only processing versus full block processing?

Log processors crawl only event logs matching a filter, so they skip transaction and receipt storage and are lighter for targeted event indexing. Full block processors store blocks, transactions, receipts, logs, and contract creations, which is required for complete chain data.