Documentation Index Fetch the complete documentation index at: https://docs.blockdb.io/llms.txt
Use this file to discover all available pages before exploring further.
The BlockDB .NET SDK targets .NET 10 and covers all EVM API endpoints. It sends your API key on every request, and supports cursor-based pagination, retries, and client-side rate limiting.
Where it’s available
Installation
dotnet add package BlockDb.Api.Sdk
Quick examples
With DI (ASP.NET Core / Generic Host)
Without DI (console / scripts)
// Program.cs
using BlockDb . Api . Sdk ;
builder . Services . AddBlockDbClient ( options =>
{
options . ApiKey = Environment . GetEnvironmentVariable ( "BLOCKDB_API_KEY" ) ! ;
});
// Inject and use anywhere
public class MyService
{
private readonly BlockDbClient _blockDb ;
public MyService ( BlockDbClient blockDb ) => _blockDb = blockDb ;
public async Task < IReadOnlyList < Block >> GetRecentBlocksAsync ( CancellationToken ct )
{
var response = await _blockDb . Primitives . GetBlocksAsync ( new GetBlocksRequest
{
ChainId = 1 ,
FromBlock = 21_000_000 ,
ToBlock = 21_001_000 ,
Limit = 100
}, ct );
return response . Data ;
}
}
// 1-hour OHLCV candles for WETH/USDC
var candles = await client . Prices . Crypto . GetOhlcAsync ( new GetPricesOhlcRequest
{
ChainId = 1 ,
BaseTokenAddress = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" , // WETH
QuoteTokenAddress = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" , // USDC
FromBlock = 21_000_000 ,
ToBlock = 21_010_000 ,
AggregationInterval = "1h" ,
});
foreach ( var candle in candles . Data )
Console . WriteLine ( $" { candle . OpenTimestamp } O: { candle . Open } H: { candle . High } L: { candle . Low } C: { candle . Close } " );
Every endpoint returns PagedResponse<T> with a Cursor property. Pass the cursor back to retrieve the next page.
Manual paging
Automatic paging (PaginationExtensions)
string ? cursor = null ;
do
{
var page = await client . Primitives . GetTransactionsAsync ( new GetTransactionsRequest
{
ChainId = 1 ,
FromBlock = 20_000_000 ,
ToBlock = 20_100_000 ,
Limit = 1000 ,
Cursor = cursor ,
});
ProcessBatch ( page . Data );
cursor = page . Cursor ;
}
while ( cursor is not null );
Configuration reference
new BlockDbClientOptions
{
// Required — from https://dashboard.blockdb.io
ApiKey = Environment . GetEnvironmentVariable ( "BLOCKDB_API_KEY" ) ! ,
// Optional overrides
ApiBaseUrl = "https://api.blockdb.io" , // default
HttpTimeout = TimeSpan . FromSeconds ( 30 ), // default
EnableRetry = true ,
MaxRetries = 3 ,
RetryBaseDelay = TimeSpan . FromMilliseconds ( 500 ),
EnableRateLimiting = true ,
MaxRequestsPerSecond = 100 ,
}
See Authorization for creating and rotating API keys.