Nethereum.BlockchainStore.Sqlite 6.0.4

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

Nethereum.BlockchainStore.Sqlite

SQLite implementation of the Nethereum blockchain storage layer using Entity Framework Core.

Overview

Nethereum.BlockchainStore.Sqlite provides the SQLite-specific DbContext, context factory, and DI registration for storing indexed Ethereum blockchain data. It inherits from Nethereum.BlockchainStore.EFCore.BlockchainDbContextBase and uses Microsoft.EntityFrameworkCore.Sqlite.

SQLite is ideal for local development, testing, single-node DevChain scenarios, and embedded applications where a full database server is not needed.

Key Features

  • SqliteBlockchainDbContext configured with UseSqlite()
  • SqliteBlockchainDbContextFactory implementing IBlockchainDbContextFactory with automatic EnsureCreated() on first use
  • AddSqliteBlockchainStorage() DI extension that registers the factory and all EFCore repositories
  • Design-time factory for dotnet ef migrations tooling

Installation

dotnet add package Nethereum.BlockchainStore.Sqlite

Targets net8.0 and net10.0.

Dependencies

  • Nethereum.BlockchainStore.EFCore - Base BlockchainDbContextBase, entity builders, and repository implementations
  • Nethereum.Microsoft.Configuration.Utils - ConfigurationUtils.Build() for appsettings-based connection string resolution
  • Microsoft.EntityFrameworkCore.Sqlite - SQLite EF Core provider
  • Microsoft.EntityFrameworkCore.Design - Design-time migration support (private asset)

Quick Start

using Nethereum.BlockchainStore.Sqlite;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddSqliteBlockchainStorage("Data Source=blockchain.db");

This registers IBlockchainDbContextFactory and all repository implementations via AddBlockchainRepositories().

Usage Examples

Direct Context Usage

var factory = new SqliteBlockchainDbContextFactory("Data Source=blockchain.db");
using var context = factory.CreateContext();

var latestBlock = await context.Blocks
    .Where(b => b.IsCanonical)
    .OrderByDescending(b => b.BlockNumber)
    .FirstOrDefaultAsync();

With Block Storage Processor

var factory = new SqliteBlockchainDbContextFactory("Data Source=blockchain.db");
var repoFactory = new BlockchainStoreRepositoryFactory(factory);

var steps = new BlockStorageProcessingSteps(repoFactory);
var orchestrator = new BlockCrawlOrchestrator(web3.Eth, steps);

var processor = new BlockchainProcessor(
    orchestrator,
    repoFactory.CreateBlockProgressRepository(),
    lastConfirmedBlockService);

await processor.ExecuteAsync(cancellationToken);

Connection String Resolution

SqliteBlockchainDbContext resolves the connection string in this order:

  1. Constructor parameter (explicit string)
  2. ConnectionStrings:SqliteConnection from appsettings.json
  3. ConnectionStrings:BlockchainDbStorage from appsettings.json

Database Schema

All tables use the same schema as Nethereum.BlockchainStore.EFCore with TEXT column type for unlimited text fields. Numeric indexing fields (BlockNumber, Timestamp, TransactionIndex, LogIndex, Nonce, TransactionType) are stored as INTEGER (SQLite's native 64-bit integer type).

Dependencies

  • Nethereum.BlockchainStore.EFCore - Base DbContext, entity builders, repositories

See Also

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Nethereum.BlockchainStore.Sqlite:

Package Downloads
Nethereum.BlockchainStorage.Processors.Sqlite

SQLite-specific DI registration for the Nethereum blockchain indexer hosted services.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
6.0.4 48 3/18/2026
6.0.3 32 3/18/2026
6.0.1 53 3/17/2026
6.0.0 54 3/16/2026