Nethereum.BlockchainStorage.Processors.Postgres
NuGet:
Nethereum.BlockchainStorage.Processors.Postgres| Source:src/Nethereum.BlockchainStorage.Processors.Postgres/
Nethereum.BlockchainStorage.Processors.Postgres
PostgreSQL-specific DI registration for the Nethereum blockchain indexer hosted services.
Overview
Provides AddPostgresBlockchainProcessor() and AddPostgresInternalTransactionProcessor() extension methods that wire together the database-agnostic processing pipeline from Nethereum.BlockchainStorage.Processors with PostgreSQL storage from Nethereum.BlockchainStore.Postgres.
Installation
dotnet add package Nethereum.BlockchainStorage.Processors.Postgres
Targets net10.0.
Dependencies
- Nethereum.BlockchainStorage.Processors - Database-agnostic processing services and hosted services
- Nethereum.BlockchainStore.Postgres - PostgreSQL DbContext and context factory
Quick Start
var builder = Host.CreateApplicationBuilder(args);
var connectionString = builder.Configuration.GetConnectionString("PostgresConnection");
builder.Services.AddPostgresBlockchainProcessor(
builder.Configuration,
connectionString);
builder.Services.AddPostgresInternalTransactionProcessor();
var host = builder.Build();
using var context = new PostgresBlockchainDbContext(connectionString);
await context.Database.MigrateAsync();
await host.RunAsync();
Connection String Resolution
The extension resolves the connection string in order:
- Explicit
connectionStringparameter ConnectionStrings:PostgresConnectionConnectionStrings:BlockchainDbStorage
Aspire Integration
var connectionString = builder.Configuration.GetConnectionString("nethereumdb");
builder.Services.AddPostgresBlockchainProcessor(builder.Configuration, connectionString);
builder.Services.AddPostgresInternalTransactionProcessor();
Configuration
See Nethereum.BlockchainStorage.Processors for BlockchainProcessingOptions configuration.
Related Packages
- Nethereum.BlockchainStorage.Processors - Base processing services
- Nethereum.BlockchainStore.Postgres - PostgreSQL storage layer
- Nethereum.BlockchainStorage.Token.Postgres - Token transfer log processing