# Health Source: https://docs.blockdb.io/api-reference/account-and-usage/health GET https://api.blockdb.io/v1/health Lightweight liveness check that returns API availability. ## Overview Returns a minimal JSON payload indicating that the BlockDB API is reachable and serving requests. Use this endpoint for uptime monitoring, load balancer health probes, and quick connectivity checks. This endpoint is intended to be inexpensive and safe to poll. It does not return account or usage data. ## Parameters No query parameters or request body. ## Response Fields Always `"ok"` when the service is healthy. ### See Also * [Usage & Limits](/api-reference/account-and-usage/usage) — Plan, shared CU, and shared `rate_limit_rps` for your account * [Authorization](/api-reference/overview/authorization) — API key usage and auth ```bash cURL theme={null} curl -s "https://api.blockdb.io/v1/health" ``` ```python Python theme={null} import requests response = requests.get("https://api.blockdb.io/v1/health") print(response.json()) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/health"); const data = await response.json(); console.log(data); ``` ```json 200 theme={null} { "status": "ok" } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Account & Usage Overview Source: https://docs.blockdb.io/api-reference/account-and-usage/overview Health check, usage, compute units, and shared account rate and CU limits. ## Overview Account & Usage endpoints help you confirm API availability and monitor consumption so you can: * Verify that the service is up (`/health`) before or during deploys * See your plan, compute unit (CU) usage, remaining balance, and reset time (`/usage`) * Read your configured requests-per-second limit for client-side throttling * Validate that automation is behaving as expected (no runaway queries) ### Endpoint Matrix | Endpoint | Summary | | -------------------------------------------------------- | --------------------------------------------------- | | [`GET /health`](/api-reference/account-and-usage/health) | Liveness check (`{"status":"ok"}`) | | [`GET /usage`](/api-reference/account-and-usage/usage) | Plan, CU usage, `cu_reset_at`, and `rate_limit_rps` | ## Key Concepts * **Subscription plan**: The `plan` field on [`/usage`](/api-reference/account-and-usage/usage) reflects your current tier. * **Compute units (CU)**: Each API call consumes a fixed number of CUs by endpoint family; `cu_used`, `cu_limit`, and `cu_remaining` track your monthly allowance. * **Reset**: `cu_reset_at` is when the CU counter rolls over for the next billing period. * **Rate limits**: `rate_limit_rps` is the account-wide RPS ceiling **shared by all API keys** (not per-key). See [Rate limiting](/api-reference/overview/rate-limiting). ## Best Practices * Poll [`/usage`](/api-reference/account-and-usage/usage) on a schedule to watch `cu_remaining` and avoid surprises near `cu_reset_at`. * Use [`/health`](/api-reference/account-and-usage/health) for load balancer or uptime checks without sending an API key when your setup allows it. * Use efficient filtering and ranges on data endpoints, and cursor-based pagination for large pulls. ## See Also * [Pricing](/pricing/home) — BlockDB subscription tiers * [Rate Limiting](/api-reference/overview/rate-limiting) — RPS limits and quotas * [Authorization](/api-reference/overview/authorization) — API key usage and auth # Usage & Limits Source: https://docs.blockdb.io/api-reference/account-and-usage/usage GET https://api.blockdb.io/v1/usage Retrieve your subscription plan, compute unit (CU) balance, billing reset time, and configured RPS limit. ## Overview Retrieves your current subscription plan, compute unit (CU) usage for the billing period, remaining allowance, when the CU counter resets, and your account’s configured requests-per-second ceiling. **CU and RPS limits are shared across every API key on the account**—see [Rate limiting](/api-reference/overview/rate-limiting). Use this endpoint to stay within quota and to align client throttling with your plan. This endpoint is free to query and does not consume compute units. ## Parameters This endpoint does not require a request body. You may authenticate with any active key; the response describes **your account**, not a per-key slice of usage or RPS. ## Response Fields Your subscription plan identifier (for example `growth`). Compute units consumed in the current billing period. Total compute units included in your plan for the current billing period. Compute units left before you hit `cu_limit` (`cu_limit` minus `cu_used`). When the CU counter resets for the next billing period (ISO-8601 UTC). Configured maximum requests per second for **your account**. All keys share this same RPS budget; it is not split per key. ### Best Practices Query this endpoint periodically (for example daily) to monitor consumption and avoid unexpected throttling near the end of a billing period. Compare `cu_remaining` with expected workload so you can upgrade or reduce query volume before hitting `cu_limit`. While this endpoint does not consume CUs, automated polling should still use a reasonable interval so you do not hit management-endpoint rate limits. ### See Also * [Health](/api-reference/account-and-usage/health) — API liveness check * [Pricing](/pricing/home) — BlockDB subscription plans * [Rate Limiting](/api-reference/overview/rate-limiting) — Understanding RPS limits and quotas * [Authorization](/api-reference/overview/authorization) — API key management ```bash cURL theme={null} curl -X GET "https://api.blockdb.io/v1/usage" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" ``` ```python Python theme={null} import requests import os response = requests.get( "https://api.blockdb.io/v1/usage", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}" } ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/usage", { method: "GET", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}` } }); const data = await response.json(); console.log(data); ``` ```json 200 theme={null} { "plan": "growth", "cu_used": 0, "cu_limit": 4100000, "cu_remaining": 4100000, "cu_reset_at": "2026-05-22T11:53:12.000Z", "rate_limit_rps": 1000 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or exchanges" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Asset Class Source: https://docs.blockdb.io/api-reference/enumerations/asset-class Asset class identifiers mapped to pricing endpoints. ## AssetClass Enumeration Defines the asset classes that can appear in price request `base` and `quote` descriptors as well as discovery responses. The `type` field inside asset descriptors must match one of the following values. | Value | Description | Notes | | -------- | -------------------------------------- | --------------------------------------------------------------------- | | `erc20` | Fungible ERC-20 token on an EVM chain. | Require `address` (EIP-55 checksum). | | `fiat` | Fiat currency. | Require ISO 4217 `code` (e.g., `USD`). | | `native` | Native gas token for a chain. | Provide `symbol`; optional `wrapped_address` for the wrapped variant. | | `index` | Synthetic/composite index. | Provide `symbol` referencing BlockDB index ID. | ### Usage Notes * Additional asset classes may be introduced over time; clients should treat unknown values as unsupported. * Asset descriptors may include supplementary metadata (e.g., `decimals`) but only the fields listed above are required for price endpoints. # Chain Source: https://docs.blockdb.io/api-reference/enumerations/chain Supported EVM chain IDs compatible with ChainList. An enumeration of supported Ethereum chain IDs. Compatible with [ChainList](https://chainlist.org/). Operational coverage and rollout status for these networks are summarized on the [Data Catalog Coverage](/data-catalog/overview/coverage) page. *** ### Values | Value | Description | Status | | ------- | ----------------- | ---------------- | | `1` | Ethereum Mainnet | ✅ Supported | | `10` | Optimism | 🔵 Investigation | | `56` | BNB Chain | 🔵 Investigation | | `130` | Unichain | 🔵 Investigation | | `137` | Polygon | 🔵 Investigation | | `146` | Sonic | 🔵 Investigation | | `5000` | Mantle | 🔵 Investigation | | `8453` | Base | 🔵 Investigation | | `42161` | Arbitrum | 🔵 Investigation | | `43114` | Avalanche C-Chain | 🔵 Investigation | | `59144` | Linea | 🔵 Investigation | Need a chain prioritized? Contact **[support@blockdb.io](mailto:support@blockdb.io)** directly and we will help scope timelines and requirements. # Dataset ID Source: https://docs.blockdb.io/api-reference/enumerations/dataset-id Dataset identifiers for BlockDB export catalogs. ## DatasetId Enumeration Defines the canonical dataset identifiers used across Historic API and WebSocket payloads (e.g., the `dataset` / `dataset_id` field). Each identifier maps to a documented REST endpoint and Postgres table in `blockdb_evm`. Prefix indicates the functional domain: * `01xx` — base chain primitives (blocks, transactions, logs, internal traces, contracts, function results) * `02xx` — token and pool metadata (ERC-20/721/1155, pools, fee terms) * `03xx` — reserves, swap prints, swap fees, transfers, flash loans * `04xx` — token-to-token OHLC, per-pool VWAP time buckets, pool yields (`0411`) * `05xx` — cross-pool token-to-token VWAP (aggregated across venues) * `06xx` — token-to-fiat (USD) VWAP * `07xx` — pool TVL in USD * `08xx` — arbitrage path definitions (`0801`) and path status (`0802`; same DDL family as `0801`) * `09xx` — arbitrage opportunities | Value | Table | Description | Notes | | ------ | -------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | | `0101` | `blockdb_evm.b0101_blocks_v1` | Canonical block headers and integrity metadata. | [`POST /evm/raw/blocks`](/api-reference/evm/primitives/blocks) | | `0102` | `blockdb_evm.b0102_transactions_v1` | Executed transactions with gas, status, and calldata. | [`POST /evm/raw/transactions`](/api-reference/evm/primitives/transactions) | | `0103` | `blockdb_evm.b0103_logs_v1` | Event logs emitted by smart contracts. | [`POST /evm/raw/logs`](/api-reference/evm/primitives/logs) | | `0111` | `blockdb_evm.b0111_internal_transactions_v1` | Internal transactions (call traces). | [`POST /evm/raw/internal-transactions`](/api-reference/evm/primitives/internal-transactions) | | `0121` | `blockdb_evm.b0121_contracts_v1` | Contract deployments (CREATE/CREATE2), keyed by `contract_id`. | [`POST /evm/raw/contracts`](/api-reference/evm/primitives/contracts) | | `0122` | `blockdb_evm.b0122_function_results_v1` | Contract call return values versioned by block. | [`POST /evm/raw/function-results`](/api-reference/evm/primitives/function-results) | | `0201` | `blockdb_evm.b0201_erc20_tokens_v1` | ERC-20 token metadata. | [`POST /evm/entities/tokens/erc20`](/api-reference/evm/entities/tokens-erc20) | | `0202` | `blockdb_evm.b0202_erc721_tokens_v1` | ERC-721 collection metadata. | [`POST /evm/entities/tokens/erc721`](/api-reference/evm/entities/tokens-erc721) | | `0203` | `blockdb_evm.b0203_erc1155_tokens_v1` | ERC-1155 contract metadata. | [`POST /evm/entities/tokens/erc1155`](/api-reference/evm/entities/tokens-erc1155) | | `0211` | `blockdb_evm.b0211_liquidity_pools_v1` | Liquidity pool registry. | [`POST /evm/entities/pools`](/api-reference/evm/entities/pools) | | `0212` | `blockdb_evm.b0212_liquidity_pools_fee_terms_v1` | Versioned pool fee terms. | [`POST /evm/entities/pools/fee-terms`](/api-reference/evm/entities/fee-terms) | | `0301` | `blockdb_evm.b0301_liquidity_pools_reserves_v1` | Pool reserve / state snapshots. Companion details: `b0301_liquidity_pools_reserves_details_v1` (join on `snapshot_id` = `_tracing_id`). | [`POST /evm/reserves`](/api-reference/evm/reserves/reserves) | | `0302` | `blockdb_evm.b0302_token_to_token_prices_swap_prints_v1` | Executed swap prints (realized prices). | [`POST /evm/prices/spot/crypto/prints`](/api-reference/evm/prices/crypto/prices-spot-prints) | | `0303` | `blockdb_evm.b0303_liquidity_pools_swap_fees_v1` | Per-swap fee accounting. | [`POST /evm/swaps/fees`](/api-reference/evm/swaps/swap-fees) | | `0304` | `blockdb_evm.b0304_token_transfers_v1` | Token transfers (native, ERC-20/721/1155). | [`POST /evm/transfers/token-transfers`](/api-reference/evm/transfers/token-transfers) | | `0305` | `blockdb_evm.b0305_flash_loan_prints_v1` | Flash loan borrow/repay prints. | [`POST /evm/flash-loans/prints`](/api-reference/evm/flash-loans/flash-loan-prints) | | `0404` | `blockdb_evm.b0404_token_to_token_prices_ohlc_v1` | Time-bucketed OHLC per pool and direction. | [`POST /evm/prices/spot/crypto/ohlc`](/api-reference/evm/prices/crypto/prices-spot-ohlc) | | `0405` | `blockdb_evm.b0405_token_to_token_vwap_v1` | Time-bucketed token-to-token VWAP. | [`POST /evm/prices/spot/crypto/vwap`](/api-reference/evm/prices/crypto/prices-spot-vwap) | | `0411` | `blockdb_evm.b0411_liquidity_pools_yields_v1` | Pool yield / ROI predictions. | [`POST /evm/yields`](/api-reference/evm/yields/yields) | | `0505` | `blockdb_evm.b0505_token_to_token_cross_pool_vwap_v1` | Cross-venue token-to-token VWAP (all pools aggregated). | [`POST /evm/prices/spot/crypto/vwap-aggregate`](/api-reference/evm/prices/crypto/prices-spot-vwap-aggregate) | | `0605` | `blockdb_evm.b0605_token_to_fiat_vwap` | Token-to-USD VWAP time buckets. | [`POST /evm/prices/spot/fiat/vwap`](/api-reference/evm/prices/fiat/prices-spot-vwap-fiat) | | `0701` | `blockdb_evm.b0701_liquidity_pools_tvl_usd_v1` | Pool TVL snapshots in USD. | [`POST /evm/tvl`](/api-reference/evm/tvl/tvl-usd) | | `0801` | `blockdb_evm.b0801_arb_paths_v1` | Arbitrage path definitions (topology). | [`POST /evm/arb/paths`](/api-reference/evm/arbitrage/arb-paths) | | `0802` | `blockdb_evm.b0801_arb_path_status_v1` | Path active/inactive status events. Same DDL family as `0801`. | [`POST /evm/arb/path-status`](/api-reference/evm/arbitrage/arb-path-status) | | `0901` | `blockdb_evm.b0901_arb_opportunities_v1` | Arbitrage opportunities per path and position. | [`POST /evm/arb/opportunities`](/api-reference/evm/arbitrage/arb-opportunities) | ### Usage Notes * For a full tabular index (same IDs and tables), see [Dataset index](/data-catalog/evm/dataset-index). * Responses that expose a `dataset` field use one of the identifiers above (or the full table name, e.g. `blockdb_evm.b0201_erc20_tokens_v1`). * New datasets follow the same prefix scheme; clients should tolerate unknown IDs to remain forward compatible. * Use this enumeration to drive UI labels and access control lists rather than hardcoding endpoint prefixes. # Digital Exchange Source: https://docs.blockdb.io/api-reference/enumerations/digital-exchange Enumerates decentralized exchange (DEX) protocol identifiers used across price feeds and pool metadata. An enumeration of supported decentralized exchange protocol IDs. These identifiers map to AMM protocols and DEX implementations across supported EVM chains. Rollout narrative and lifecycle details remain on the [Data Catalog Coverage](/data-catalog/overview/coverage) page. *** ### Values | Value | Description | Notes | Status | | ----- | -------------- | ------------------------------------ | ---------------- | | `2` | Uniswap V2 | Constant product (x·y=k). | ✅ Supported | | `3` | Uniswap V3 | Concentrated liquidity. | ✅ Supported | | `4` | Uniswap V4 | Hook-enabled architecture. | ✅ Supported | | `12` | Balancer V2 | Weighted/stable pools. | 🔵 Investigation | | `13` | Balancer V3 | Next-generation Balancer pools. | 🔵 Investigation | | `22` | SushiSwap V2 | Fork of Uniswap V2. | ✅ Supported | | `23` | SushiSwap V3 | Concentrated liquidity. | ✅ Supported | | `32` | PancakeSwap V2 | Constant product AMM. | ✅ Supported | | `33` | PancakeSwap V3 | Concentrated liquidity. | ✅ Supported | | `61` | Maverick V1 | Maverick V1 decentralized exchange. | 🔵 Investigation | | `62` | Maverick V2 | Maverick V2 decentralized exchange. | 🔵 Investigation | | `81` | ShibaSwap V1 | ShibaSwap V1 decentralized exchange. | ✅ Supported | | `82` | ShibaSwap V2 | ShibaSwap V2 decentralized exchange. | ✅ Supported | ### Additional DEX protocols (roadmap) The protocols below appear in the [Data Catalog Coverage](/data-catalog/overview/coverage) roadmap. `exchange_id` values are listed in the table above only once they are part of this public API enumeration. | Protocol | Status | | ------------------------ | ---------------- | | **Curve** | 🔵 Investigation | | **Joe V2** | 🔵 Investigation | | **Joe V2.1** | 🔵 Investigation | | **Joe V2.2** | 🔵 Investigation | | **BaseSwap** | 🔵 Investigation | | **Aerodrome Slipstream** | 🔵 Investigation | | **Aerodrome V1** | 🔵 Investigation | | **Velodrome V1** | 🔵 Investigation | | **Velodrome V2** | 🔵 Investigation | | **Velodrome V3** | 🔵 Investigation | | **PulseX V1** | 🔵 Investigation | | **PulseX V2** | 🔵 Investigation | ### Usage Notes * Exchange IDs map to protocol implementations, not individual pool addresses. Use these identifiers when filtering by `exchange_id` in reserves and pricing endpoints. * Status here matches the coverage table; see [Data Catalog Coverage](/data-catalog/overview/coverage) for how protocols roll out across networks. * Additional protocols may be added over time; clients should gracefully handle unknown exchange IDs. Planning a new DEX integration or need a protocol prioritized? Email **[support@blockdb.io](mailto:support@blockdb.io)** to talk through scope and timelines with the team. # Fiat Currency Source: https://docs.blockdb.io/api-reference/enumerations/fiat-currency Fiat codes available for quote currency conversions. ## FiatCurrency Enumeration Defines the ISO 4217 fiat codes that can be referenced in price descriptors, quotes, and conversions. | Value | Description | Notes | | ----- | -------------------- | ----------------------------------- | | `USD` | United States Dollar | ISO 4217 code `USD`; default quote. | ### Usage Notes * Additional fiat codes may be added over time; unknown values should be rejected gracefully. * Fiat descriptors may include supplementary metadata (e.g., display `symbol`), but only the `code` is required. # Market Kind Source: https://docs.blockdb.io/api-reference/enumerations/market-kind Market classification values for centralized exchange data. ## MarketKind Enumeration Identifies the market surface targeted by price endpoints and discovery entries. | Value | Description | Notes | | ------ | -------------------------------------------------------------------------- | --------------- | | `spot` | Real-time and historical spot markets derived from on-chain DEX liquidity. | Default surface | ### Usage Notes * Future releases may introduce additional market kinds (e.g., `derivative`, `options`). * Requests specifying unsupported values return `400 Bad Request`. # Enumerations Overview Source: https://docs.blockdb.io/api-reference/enumerations/overview Reference tables for chain IDs, asset classes, exchange types, and other canonical identifiers. ## Overview Enumerations provide canonical reference data used across BlockDB API requests and responses. These identifiers ensure consistent data classification and enable filtering across datasets. All enumeration values are stable and versioned independently from dataset schemas. ### Enumeration Reference | Enumeration | Description | Use Cases | | ------------------------------------------------------------------ | --------------------------------------------------------------------- | ------------------------------------------------------------------- | | [`Chain`](/api-reference/enumerations/chain) | Supported EVM chain IDs compatible with ChainList | Filter datasets by network, specify `chain_id` in all requests | | [`Digital Exchange`](/api-reference/enumerations/digital-exchange) | DEX protocol identifiers for pools and price feeds | Filter reserves and pricing data by exchange type | | [`Dataset ID`](/api-reference/enumerations/dataset-id) | Canonical dataset identifiers mapping to API endpoints | Reference datasets in lineage and catalog queries | | [`Pool Type`](/api-reference/enumerations/pool-type) | AMM pool archetype classifications | Filter pools and reserves by liquidity model | | [`Transfer Type`](/api-reference/enumerations/transfer-type) | Token transfer mechanism codes (native tx, internal, ERC-20/721/1155) | Interpret and filter `transfer_type` on the token transfers dataset | | [`Asset Class`](/api-reference/enumerations/asset-class) | Asset type identifiers (ERC-20, fiat, native, index) | Construct price request descriptors | | [`Fiat Currency`](/api-reference/enumerations/fiat-currency) | ISO 4217 fiat currency codes | Specify quote currencies in pricing endpoints | | [`Market Kind`](/api-reference/enumerations/market-kind) | Market classification (spot, derivative, etc.) | Scope pricing queries to specific market surfaces | ### Parameter Conventions * Enumeration values are case-sensitive and must match exactly as documented * Use numeric IDs for chain, exchange, pool type, and transfer type enumerations * Use string codes for asset class, fiat currency, and market kind * All enumeration values are immutable within a major version ### Usage Guidance * **Cache enumerations client-side** — values change infrequently and can be cached for extended periods * **Validate before requests** — check that enumeration values exist before constructing API requests to avoid `400 Bad Request` errors * **Reference in filters** — use enumeration IDs in request body filters (e.g., `exchange_ids`, `pool_type_ids`) rather than hardcoding values * **Monitor updates** — subscribe to [Release Notes](/release-notes/home) for new enumeration values or deprecations ### See Also * [Chain](/api-reference/enumerations/chain) — EVM network identifiers * [Digital Exchange](/api-reference/enumerations/digital-exchange) — DEX protocol identifiers * [Dataset ID](/api-reference/enumerations/dataset-id) — Dataset catalog mapping * [Pool Type](/api-reference/enumerations/pool-type) — AMM pool classifications * [Transfer Type](/api-reference/enumerations/transfer-type) — Token transfer mechanism codes * [Asset Class](/api-reference/enumerations/asset-class) — Asset type system * [Fiat Currency](/api-reference/enumerations/fiat-currency) — Currency codes * [Market Kind](/api-reference/enumerations/market-kind) — Market classifications # Pool Type Source: https://docs.blockdb.io/api-reference/enumerations/pool-type Recognized AMM pool archetypes across supported chains. Integer codes identifying automated market maker pool archetypes. *** ### Values | Value | Description | Notes | | ------ | --------------------------- | ----------------------------------------------------------------------------------------------------------------------- | | `201` | Uniswap V2 pool | `dex_type_id=2` · flat fee `0.30%` (`total_fee=0.003`) | | `301` | Uniswap V3 pool (0.01%) | `dex_type_id=3` · tick spacing · `total_fee=0.0001` | | `302` | Uniswap V3 pool (0.05%) | `dex_type_id=3` · tick spacing · `total_fee=0.0005` | | `303` | Uniswap V3 pool (0.30%) | `dex_type_id=3` · tick spacing · `total_fee=0.003` | | `304` | Uniswap V3 pool (1.00%) | `dex_type_id=3` · tick spacing · `total_fee=0.01` | | `2201` | SushiSwap V2 pool | `dex_type_id=22` · `total_fee=0.003` (example split: `user_fee=0.0025`, `protocol_fee=0.0005`) | | `3201` | PancakeSwap V2 pool | `dex_type_id=32` · `total_fee=0.0025` (example split: `user_fee=0.0017`, `protocol_fee=0.000225`, `extra_fee=0.000575`) | | `3301` | PancakeSwap V3 pool (0.01%) | `dex_type_id=33` · tick spacing · `total_fee=0.0001` | | `3302` | PancakeSwap V3 pool (0.05%) | `dex_type_id=33` · tick spacing · `total_fee=0.0005` | | `3303` | PancakeSwap V3 pool (0.25%) | `dex_type_id=33` · tick spacing · `total_fee=0.0025` | | `3304` | PancakeSwap V3 pool (1.00%) | `dex_type_id=33` · tick spacing · `total_fee=0.01` | | `8101` | ShibaSwap V1 pool | `dex_type_id=81` · flat fee `0.30%` (`total_fee=0.003`) | # Arbitrage Opportunities Source: https://docs.blockdb.io/api-reference/evm/arbitrage/arb-opportunities POST https://api.blockdb.io/v1/evm/arb/opportunities Query arbitrage opportunity snapshots (dataset 0901): per-hop amounts, token profit, and USD profit. **Not publicly available:** This dataset is not included in the standard public API. Request access via a custom plan — contact [support@blockdb.io](mailto:support@blockdb.io). ## Overview * **Dataset ID:** [`0901 - Arbitrage Opportunities`](/data-catalog/evm/arbitrage/arb-opportunities) * **Description:** Opportunities computed for active paths at a specific `(block_number, tx_index, log_index)`; ties to `path_id` and `is_reversed`. * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/MEV-Arbitrage-Opportunities-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0901_arb_opportunities_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/MEV-Arbitrage-Opportunities-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0901_arb_opportunities_v1.json?download=true) ## Parameters Target EVM network. *See the [Chain](/api-reference/enumerations/chain) enumeration.* #### Range filters (mutually exclusive) Starting block number (inclusive). Use with `to_block`. Ending block number (inclusive). Use with `from_block`. Starting timestamp (ISO-8601). Use with `to_timestamp`. Ending timestamp (ISO-8601). Use with `from_timestamp`. Validation rule:\ Provide **either** a block range **or** a time range **or** filter by `path_ids`.\ Do not mix block and timestamp ranges in one request. #### Direct selectors Filter by 32-byte `path_id` values (hex, no `0x` prefix). #### Pagination Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Opaque pagination cursor from a previous response. ## Response fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Echo of `path_ids`, pagination, etc. #### Data Opportunity records matching the request. Observation block. UTC timestamp of the observation. Transaction index within the block. Log index within the transaction. 32-byte path id (hex, no `0x`). `true` if the path was evaluated in the reversed direction. Pool UIDs in evaluated (directional) order (hex). Token addresses in evaluated order (hex). Per-hop amounts as decimal strings, aligned with `token_path`. Estimated profit in `token_path[0]` units. USD price of `token_path[0]`. Estimated profit in USD. Row tracing id (hex, no `0x`). Parent tracing ids. Record creation timestamp (ISO-8601). Last update timestamp (ISO-8601). #### Envelope Pagination cursor. Number of rows in `data`. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/arb/opportunities" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "from_block": 21000000, "to_block": 21001000, "limit": 25 }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"from_block\":21000000,\"to_block\":21001000,\"limit\":25}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/arb/opportunities"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"from_block\":21000000,\"to_block\":21001000,\"limit\":25}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/arb/opportunities", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/arb/opportunities", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={"chain_id": 1, "from_block": 21000000, "to_block": 21001000, "limit": 25} ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/arb/opportunities", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "from_block": 21000000, "to_block": 21001000, "limit": 25 }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "from_block": 21000000, "to_block": 21001000, "limit": 25 }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/arb/opportunities", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "request_window": { "from_block": 21000000, "to_block": 21001000, "from_timestamp": null, "to_timestamp": null }, "resolved_window": { "from_block": 21000000, "to_block": 21001000, "from_timestamp": null, "to_timestamp": null }, "filters": { "path_ids": [], "limit": 25, "cursor": null } }, "data": [ { "block_number": 21000500, "block_time": "2025-11-11T12:00:00Z", "tx_index": 8, "log_index": 4, "path_id": "a1b2c3d4e5f6789012345678901234567890abcd1234567890abcdef12345678", "is_reversed": false, "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000", "11b815acc87f6f89741a636d1ebfcea40876f8f0000000000000000000000000" ], "token_path": [ "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" ], "amounts": [ "1000000000000000000", "3500000000", "1000500000000000000" ], "profit_in_tokens": "50000000000000000", "token_vwap_usd": "3200.50", "profit_in_usd": "160.025", "_tracing_id": "0901c0ffee000000000000000000000000000000000000000000000000000001", "_parent_tracing_ids": [ "0801c0ffee000000000000000000000000000000000000000000000000000001" ], "_created_at": "2025-11-11T12:00:05Z", "_updated_at": "2025-11-11T12:00:05Z" } ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or contract addresses" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Arbitrage Path Status Source: https://docs.blockdb.io/api-reference/evm/arbitrage/arb-path-status POST https://api.blockdb.io/v1/evm/arb/path-status Query path active/inactive status events per path_id (dataset 0802). **Not publicly available:** This dataset is not included in the standard public API. Request access via a custom plan — contact [support@blockdb.io](mailto:support@blockdb.io). ## Overview * **Dataset ID:** [`0802 - Arb Path Status`](/data-catalog/evm/arbitrage/arb-paths#arb-path-status-b0801_arb_path_status_v1) * **Description:** Path status events (`b0801_arb_path_status_v1`): active/inactive transitions keyed by `(path_id, block_number, tx_index, log_index)`; `trigger_pool_uid` identifies the pool whose TVL/state change produced the event. * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/MEV-Arbitrage-Paths-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0801_arb_path_status_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/MEV-Arbitrage-Paths-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0801_arb_path_status_v1.json?download=true) ## Parameters Target EVM network. *See the [Chain](/api-reference/enumerations/chain) enumeration.* #### Range filters (mutually exclusive) Starting block number (inclusive). Use with `to_block`. Ending block number (inclusive). Use with `from_block`. Starting timestamp (ISO-8601). Use with `to_timestamp`. Ending timestamp (ISO-8601). Use with `from_timestamp`. Validation rule:\ Provide **either** a block range **or** a time range **or** filter by `path_ids`.\ Do not mix block and timestamp ranges in one request. #### Direct selectors Filter by 32-byte `path_id` values (hex, no `0x` prefix). Cross-reference [Arbitrage paths](/data-catalog/evm/arbitrage/arb-paths) for path definitions. When set, return only rows where the path became active (`true`) or inactive (`false`). #### Pagination Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Opaque pagination cursor from a previous response. ## Response fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Echo of `path_ids`, `is_active`, pagination, etc. #### Data Path status events matching the request. 32-byte path id (hex, no `0x`). Block of the status event. UTC timestamp of the event row. Transaction index within the block. Log index within the transaction. Whether the path is active after this event. 32-byte pool UID whose state change triggered the status update (hex, no `0x`). Row tracing id (hex, no `0x`). Parent tracing ids. Record creation timestamp (ISO-8601). Record last update timestamp (ISO-8601). #### Envelope Pagination cursor. Number of rows in `data`. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/arb/path-status" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "from_block": 21000000, "to_block": 21001000, "limit": 25 }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"from_block\":21000000,\"to_block\":21001000,\"limit\":25}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/arb/path-status"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"from_block\":21000000,\"to_block\":21001000,\"limit\":25}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/arb/path-status", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/arb/path-status", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={"chain_id": 1, "from_block": 21000000, "to_block": 21001000, "limit": 25} ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/arb/path-status", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "from_block": 21000000, "to_block": 21001000, "limit": 25 }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "from_block": 21000000, "to_block": 21001000, "limit": 25 }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/arb/path-status", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "request_window": { "from_block": 21000000, "to_block": 21001000, "from_timestamp": null, "to_timestamp": null }, "resolved_window": { "from_block": 21000000, "to_block": 21001000, "from_timestamp": null, "to_timestamp": null }, "filters": { "path_ids": [], "limit": 25, "cursor": null } }, "data": [ { "path_id": "a1b2c3d4e5f6789012345678901234567890abcd1234567890abcdef12345678", "block_number": 21000800, "block_time": "2025-11-11T14:00:00Z", "tx_index": 5, "log_index": 2, "is_active": true, "trigger_pool_uid": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000", "_tracing_id": "0802c0ffee000000000000000000000000000000000000000000000000000001", "_parent_tracing_ids": [ "0801c0ffee000000000000000000000000000000000000000000000000000001" ], "_created_at": "2025-11-11T14:00:01.000Z", "_updated_at": "2025-11-11T14:00:01.000Z" } ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or contract addresses" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Arbitrage Paths Source: https://docs.blockdb.io/api-reference/evm/arbitrage/arb-paths POST https://api.blockdb.io/v1/evm/arb/paths Query arbitrage path definitions: pool UID cycle and token cycle per path_id (dataset 0801). **Not publicly available:** This dataset is not included in the standard public API. Request access via a custom plan — contact [support@blockdb.io](mailto:support@blockdb.io). ## Overview * **Dataset ID:** [`0801 - Arbitrage Paths`](/data-catalog/evm/arbitrage/arb-paths) * **Description:** Returns arbitrage path rows. Binary fields are returned as hex strings (no `0x` prefix) in JSON. * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/MEV-Arbitrage-Paths-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb0701_arb_paths_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/MEV-Arbitrage-Paths-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb0701_arb_paths_v1.json?download=true) ## Parameters Target EVM network. *See the [Chain](/api-reference/enumerations/chain) enumeration.* #### Range filters (mutually exclusive) Starting block number (inclusive). Use with `to_block`. Ending block number (inclusive). Use with `from_block`. Starting timestamp (ISO-8601). Use with `to_timestamp`. Ending timestamp (ISO-8601). Use with `from_timestamp`. Validation rule:\ Provide **either** a block range **or** a time range **or** filter by `path_ids` (direct selectors).\ Do not mix block and timestamp ranges in one request. Invalid combinations return HTTP 400. #### Direct selectors Filter by 32-byte `path_id` values (hex string, no `0x` prefix). #### Pagination Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Opaque pagination cursor from a previous response. ## Response fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Filter parameters echoed from the request (`path_ids`, pagination, etc.). #### Data Path definition records matching the request. 32-byte path identifier (hex, no `0x`). Block where the path was first observed. UTC timestamp of that block. Transaction index within the block. Log index within the transaction. Pool UIDs in canonical cycle order (hex, 32-byte each). Token addresses in canonical cycle order (hex, 20-byte each), e.g. (A,B,A) or (A,B,C,A). Row tracing id (hex, no `0x`). Parent tracing ids. Record creation timestamp (ISO-8601). Last update timestamp (ISO-8601). #### Envelope Pagination cursor. Number of rows in `data`. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/arb/paths" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "from_block": 21000000, "to_block": 21001000, "limit": 25 }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"from_block\":21000000,\"to_block\":21001000,\"limit\":25}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/arb/paths"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"from_block\":21000000,\"to_block\":21001000,\"limit\":25}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/arb/paths", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/arb/paths", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={"chain_id": 1, "from_block": 21000000, "to_block": 21001000, "limit": 25} ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/arb/paths", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "from_block": 21000000, "to_block": 21001000, "limit": 25 }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "from_block": 21000000, "to_block": 21001000, "limit": 25 }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/arb/paths", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "request_window": { "from_block": 21000000, "to_block": 21001000, "from_timestamp": null, "to_timestamp": null }, "resolved_window": { "from_block": 21000000, "to_block": 21001000, "from_timestamp": null, "to_timestamp": null }, "filters": { "path_ids": [], "limit": 25, "cursor": null } }, "data": [ { "path_id": "a1b2c3d4e5f6789012345678901234567890abcd1234567890abcdef12345678", "block_number": 21000500, "block_time": "2025-11-11T12:00:00Z", "tx_index": 3, "log_index": 12, "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000", "11b815acc87f6f89741a636d1ebfcea40876f8f0000000000000000000000000" ], "token_cycle": [ "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" ], "_tracing_id": "0801c0ffee000000000000000000000000000000000000000000000000000001", "_parent_tracing_ids": [ "0301c0ffee000000000000000000000000000000000000000000000000000001" ], "_created_at": "2025-11-11T12:00:05Z", "_updated_at": "2025-11-11T12:00:05Z" } ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or contract addresses" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Arbitrage Overview Source: https://docs.blockdb.io/api-reference/evm/arbitrage/overview Query arbitrage path topology, path status changes, and opportunity snapshots. ## Overview Arbitrage datasets describe cyclic routes across pools ([`0801`](/data-catalog/evm/arbitrage/arb-paths)), activation events for those routes ([`0802`](/data-catalog/evm/arbitrage/arb-paths#arb-path-status-b0801_arb_path_status_v1)), and evaluated profit snapshots at concrete chain positions ([`0901`](/data-catalog/evm/arbitrage/arb-opportunities)). ### Endpoint matrix | Endpoint | Summary | Dataset ID | | ------------------------------------------------------------------------------- | -------------------------------------------------------- | ---------- | | [`POST /evm/arb/paths`](/api-reference/evm/arbitrage/arb-paths) | Path definitions (`path_id`, `pool_uids`, `token_cycle`) | `0801` | | [`POST /evm/arb/path-status`](/api-reference/evm/arbitrage/arb-path-status) | Active/inactive status events per `path_id` | `0802` | | [`POST /evm/arb/opportunities`](/api-reference/evm/arbitrage/arb-opportunities) | Profit and token amounts per path and position | `0901` | Dataset **`0802`** (path status) is documented alongside **`0801`** on the [arbitrage paths](/data-catalog/evm/arbitrage/arb-paths) catalog page. ### Related * [Dataset ID](/api-reference/enumerations/dataset-id) * [Arbitrage catalog](/data-catalog/evm/arbitrage/arb-paths) # Pools · Fee Terms Source: https://docs.blockdb.io/api-reference/evm/entities/fee-terms POST https://api.blockdb.io/v1/evm/entities/pools/fee-terms Read versioned AMM pool fee configuration (total fee and fee-split terms) for joinable pool economics. ## Overview * **Dataset ID:** [`0212 - Liquidity Pool Fee Terms`](/data-catalog/evm/entities/liquidity-pools-fee-terms) * **Description:** Retrieves versioned fee terms for liquidity pools, including the total swap fee fraction (e.g., `0.003`) and optional split fractions across LP/user, protocol, and extra recipients. * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/Liquidity-Pools-Fee-Terms-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0212_liquidity_pools_fee_terms_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/Liquidity-Pools-Fee-Terms-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0212_liquidity_pools_fee_terms_v1.json?download=true) ## Parameters Target EVM network. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.* #### Range Filters (mutually exclusive) Starting block number (inclusive) for the query. Use with `to_block`. Ending block number (inclusive) for the query. Use with `from_block`. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Use with `to_timestamp`. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. Use with `from_timestamp`. Validation rule:\ You must provide **either** a block range, a time range, or at least one direct selector.\ Providing more than one option results in HTTP 400.\ Providing none results in HTTP 400. #### Pool Selectors Filter fee terms by exchange IDs. *See the [DigitalExchange](/api-reference/enumerations/digital-exchange) enumeration for supported values.* Filter by BlockDB pool identifiers (`uid` from `/evm/entities/pools`). Filter by pool contract addresses (hex string, 20 bytes, no `0x` prefix). Filter by protocol-specific pool identifiers (e.g., Uniswap V4 `pool_id`). Filter by AMM archetype. *See the [PoolType](/api-reference/enumerations/pool-type) enumeration for supported values.* #### Pagination Controls Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Pagination cursor from a prior call. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Filters echoed from the request (selectors, pagination state, etc.). #### Data Array of pool fee-terms records matching the request. BlockDB pool identifier (`uid` from `/evm/entities/pools`). Exchange/DEX identifier. Pool type identifier. Block height where the fee-terms record is anchored. Block timestamp joined from the `blocks` table for easier aggregation. Zero-based index of the parent transaction within the block. Position of the log within the transaction. Total fee fraction (e.g., `0.003` = 0.30%). Returned as a string to preserve precision. Absolute fee fraction allocated to LPs/users (same units as `total_fee`). Returned as a string to preserve precision. Absolute fee fraction allocated to protocol/treasury (same units as `total_fee`). Returned as a string to preserve precision. Absolute fee fraction allocated to extra destinations (burn, staking, etc.) (same units as `total_fee`). Returned as a string to preserve precision. Row-level lineage hash (hex string, no `0x` prefix). Lineage references of immediate parents. Record creation timestamp (ISO-8601). Last update timestamp (ISO-8601). #### Envelope Fields Cursor token for pagination. Number of records returned in `data`. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/entities/pools/fee-terms" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "from_block": 19000000, "to_block": 19010000, "pool_addresses": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f564" ], "limit": 250 }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"from_block\":19000000,\"to_block\":19010000,\"pool_addresses\":[\"88e6a0c2ddd26feeb64f039a2c41296fcb3f564\"],\"limit\":250}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/entities/pools/fee-terms"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"from_block\":19000000,\"to_block\":19010000,\"pool_addresses\":[\"88e6a0c2ddd26feeb64f039a2c41296fcb3f564\"],\"limit\":250}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/entities/pools/fee-terms", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/entities/pools/fee-terms", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={'chain_id': 1, 'from_block': 19000000, 'to_block': 19010000, 'pool_addresses': ['88e6a0c2ddd26feeb64f039a2c41296fcb3f564'], 'limit': 250} ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/entities/pools/fee-terms", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "from_block": 19000000, "to_block": 19010000, "pool_addresses": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f564" ], "limit": 250 }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "from_block": 19000000, "to_block": 19010000, "pool_addresses": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f564" ], "limit": 250 }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/entities/pools/fee-terms", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "request_window": { "from_block": 19000000, "to_block": 19010000 }, "resolved_window": { "from_block": 19000000, "to_block": 19010000 }, "filters": { "pool_addresses": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f564" ], "limit": 250, "cursor": null } }, "data": [ { "pool_uid": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000", "exchange_id": 1, "type_id": 201, "block_number": 19001234, "block_time": "2025-12-20T12:34:56Z", "tx_index": 7, "log_index": 12, "total_fee": "0.003000000000000000", "user_fee": "0.003000000000000000", "protocol_fee": "0.000000000000000000", "extra_fee": "0.000000000000000000", "_tracing_id": "0204c0ffee000000000000000000000000000000000000000000000000000001", "_parent_tracing_ids": [ "0103c0ffee000000000000000000000000000000000000000000000000000001" ], "_created_at": "2025-12-20T12:35:01Z", "_updated_at": "2025-12-20T12:35:01Z" } ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or exchanges" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, # configured rate limit "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Tokens & Liquidity Overview Source: https://docs.blockdb.io/api-reference/evm/entities/overview Discover tokens and liquidity pools with standardized metadata and identifiers. ## Overview The Tokens & Liquidity suite provides access to token registries and automated market maker (AMM) pool metadata. These endpoints deliver standardized identifiers and classification data that enable consistent cross-dataset joins and filtering. All records include lineage fields linking back to on-chain creation events. ### Endpoint Matrix | Endpoint | Summary | Dataset ID | Typical Latency | | --------------------------------------------------------------------------------- | -------------------------------- | ---------- | --------------- | | [`POST /evm/entities/tokens/erc20`](/api-reference/evm/entities/tokens-erc20) | ERC-20 token registry | `0201` | \< 200 ms | | [`POST /evm/entities/tokens/erc721`](/api-reference/evm/entities/tokens-erc721) | ERC-721 collection registry | `0202` | \< 200 ms | | [`POST /evm/entities/tokens/erc1155`](/api-reference/evm/entities/tokens-erc1155) | ERC-1155 contract registry | `0203` | \< 200 ms | | [`POST /evm/entities/pools`](/api-reference/evm/entities/pools) | AMM pool registry | `0211` | \< 200 ms | | [`POST /evm/entities/pools/fee-terms`](/api-reference/evm/entities/fee-terms) | Pool fee configuration over time | `0212` | \< 200 ms | ### Parameter Conventions ERC-20 contract address filter (hex string, 20 bytes, no `0x` prefix). BlockDB pool identifier for direct pool lookups. Pool contract addresses for AMM pools. Starting block number (inclusive) for creation-time filtering. Ending block number (inclusive) for creation-time filtering. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. Chain identifier for the target EVM network. See [Chain enumeration](/api-reference/enumerations/chain) for supported values. Pool type filters. Use [Pool Type enumeration](/api-reference/enumerations/pool-type) values. ### Usage Guidance * **Start with pools** — Use `/evm/entities/pools` to discover available liquidity before querying reserves * **Join with reserves** — Link pool metadata to reserve snapshots via `pool_uid` for complete liquidity analysis * **Use token addresses** — the ERC-20 endpoint accepts contract addresses for direct lookups * **Filter by creation time** — Use block/time ranges to find newly created tokens or pools * **Cache token metadata** — Token names, symbols, and decimals are immutable; cache aggressively ### Common Patterns **Find all ERC-20 tokens created in a time range:** ```json theme={null} { "chain_id": 1, "from_timestamp": "2025-01-01T00:00:00Z", "to_timestamp": "2025-01-31T23:59:59Z" } ``` **Lookup specific pool:** ```json theme={null} { "chain_id": 1, "pool_addresses": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f564" ] } ``` **Filter pools by type:** ```json theme={null} { "chain_id": 1, "pool_type_ids": [ 201, 301, 302, 303, 304 ], "from_block": 18000000 } ``` ### Dataset Relationships * **Tokens → Pools**: Join ERC-20 tokens to pools via token addresses in pool metadata * **Pools → Reserves**: Link pool metadata to reserve snapshots using `pool_uid` * **Pools → Fee Terms**: Join pool metadata to fee terms using `pool_uid` for pool economics * **Tokens → Prices**: Use token addresses in pricing endpoints to get market data ### See Also * [`POST /evm/entities/tokens/erc20`](/api-reference/evm/entities/tokens-erc20) — ERC-20 token registry * [`POST /evm/entities/pools`](/api-reference/evm/entities/pools) — AMM pool registry * [`POST /evm/entities/pools/fee-terms`](/api-reference/evm/entities/fee-terms) — Pool fee configuration * [`POST /evm/reserves`](/api-reference/evm/reserves/reserves) — Pool reserve snapshots * [Pool Type](/api-reference/enumerations/pool-type) — AMM pool classifications * [Digital Exchange](/api-reference/enumerations/digital-exchange) — DEX protocol identifiers # Pools Source: https://docs.blockdb.io/api-reference/evm/entities/pools POST https://api.blockdb.io/v1/evm/entities/pools List AMM pools with reserves, fee tiers, and routing hints. ## Overview * **Dataset ID:** [`0211 - Liquidity Pools`](/data-catalog/evm/entities/liquidity-pools) * **Description:** Canonical list of pools; child time-series tables FK to blockdb\_evm.b0211\_liquidity\_pools\_v1(pool\_uid). * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/Liquidity-Pools-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0211_liquidity_pools_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/Liquidity-Pools-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0211_liquidity_pools_v1.json?download=true) ## Parameters Target EVM network. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.* #### Range Filters (mutually exclusive) Starting block number (inclusive) for the query. Use with `to_block`. Ending block number (inclusive) for the query. Use with `from_block`. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Use with `to_timestamp`. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. Use with `from_timestamp`. Validation rule:\ You must provide **either** a block range, a time range, or at least one direct selector.\ Providing more than one option results in HTTP 400.\ Providing none results in HTTP 400. #### Pool Selectors Specific pool contract address to return (hex string, 20 bytes, no `0x` prefix). May be used on its own, without a block or time range. Internal BlockDB pool ids to return (each a 32-byte hex string, no `0x` prefix). May be used on its own, without a block or time range. Filter snapshots by exchange IDs. *See the [DigitalExchange](/api-reference/enumerations/digital-exchange) enumeration for supported values.* Filter pools by archetype. *See the [PoolType](/api-reference/enumerations/pool-type) enumeration for supported values.* ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Filter parameters echoed from the request. #### Data Array of pool objects. Each row matches the linked dataset. Internal BlockDB pool id (32-byte hex string, no `0x` prefix). Exchange/DEX identifier. *See the [DigitalExchange](/api-reference/enumerations/digital-exchange) enumeration for supported values.* Pool type identifier. *See the [PoolType](/api-reference/enumerations/pool-type) enumeration for supported values.* Block number where the pool was first recognized. Block time (ISO-8601). Zero-based transaction index within the block. Zero-based log index within the transaction. Factory or pool-manager contract address (hex, 20 bytes, no `0x` prefix). Token contract addresses that compose the pool (each hex, 20 bytes, no `0x` prefix). Incarnation ID for v2/v3 pools: 20B address + 4B creation block + 2B tx\_index (hex-encoded). NULL for v4-style pools. On-chain pool contract address when applicable (hex, 20 bytes, no `0x` prefix). Protocol-specific pool id when applicable (for example Uniswap V4), hex string without `0x`. Ordinal for the pair within the exchange, when applicable. Asset manager contract addresses for Balancer-style pools (hex strings), or `null`. Amplification parameter for stable pools, when applicable. Token weights for weighted pools, when applicable. Tick spacing for concentrated-liquidity pools, when applicable. Row-level lineage hash (hex string, no `0x` prefix). Lineage references of immediate parents (hex strings). Record creation timestamp (ISO-8601). Last update timestamp (ISO-8601). #### Envelope Fields Cursor token for pagination. Number of records returned in `data`. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/entities/pools" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z", "exchange_ids": [ 2, 3 ], "pool_type_ids": [ 201, 302, 3303 ], "contract_address": "1234567890abcdef1234567890abcdef12345678" }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"from_block\":12345678,\"to_block\":12345999,\"from_timestamp\":\"2025-10-29T00:00:00Z\",\"to_timestamp\":\"2025-11-11T00:00:00Z\",\"exchange_ids\":[2,3],\"pool_type_ids\":[201,302,3303],\"contract_address\":\"1234567890abcdef1234567890abcdef12345678\"}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/entities/pools"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"from_block\":12345678,\"to_block\":12345999,\"from_timestamp\":\"2025-10-29T00:00:00Z\",\"to_timestamp\":\"2025-11-11T00:00:00Z\",\"exchange_ids\":[2,3],\"pool_type_ids\":[201,302,3303],\"contract_address\":\"1234567890abcdef1234567890abcdef12345678\"}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/entities/pools", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/entities/pools", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={'contract_address': '1234567890abcdef1234567890abcdef12345678', 'chain_id': 1, 'exchange_ids': [2, 3], 'from_block': 12345678, 'from_timestamp': '2025-10-29T00:00:00Z', 'pool_type_ids': [201, 302, 3303], 'to_block': 12345999, 'to_timestamp': '2025-11-11T00:00:00Z'} ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/entities/pools", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z", "exchange_ids": [ 2, 3 ], "pool_type_ids": [ 201, 302, 3303 ], "contract_address": "1234567890abcdef1234567890abcdef12345678" }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z", "exchange_ids": [ 2, 3 ], "pool_type_ids": [ 201, 302, 3303 ], "contract_address": "1234567890abcdef1234567890abcdef12345678" }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/entities/pools", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "request_window": { "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z" }, "resolved_window": { "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z" }, "filters": { "contract_address": "1234567890abcdef1234567890abcdef12345678", "pool_uids": null, "exchange_ids": [ 1, 2 ], "pool_type_ids": [ 1, 2, 4 ] } }, "data": [ { "pool_uid": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000", "exchange_id": 1, "type_id": 2, "block_number": 567890, "block_time": "2018-07-07T12:34:56.000Z", "tx_index": 4, "log_index": 2, "factory": "1f98431c8ad98523631ae4a59f267346ea31f984", "contract_id": "88e6a0c2ddd26feeb64f039a2c41296fcb3f564000000000000", "tokens": [ "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" ], "contract_address": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640", "pool_id": null, "pairnum": 42, "asset_managers": null, "amp": null, "weights": [ 0.5, 0.5 ], "tick_spacing": null, "_tracing_id": "0211000000000000000000000000000000000001", "_parent_tracing_ids": [ "0103000000000000000000000000000000000001", "0103000000000000000000000000000000000002" ], "_created_at": "2025-11-11T18:42:15.123Z", "_updated_at": "2025-11-11T18:42:15.123Z" } ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or exchanges" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, # configured rate limit "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Tokens · ERC-1155 Source: https://docs.blockdb.io/api-reference/evm/entities/tokens-erc1155 POST https://api.blockdb.io/v1/evm/entities/tokens/erc1155 Discover ERC-1155 Multi Token contracts with metadata and provenance fields. ## Overview * **Dataset ID:** [`0203 - ERC-1155 Tokens`](/data-catalog/evm/entities/erc1155-tokens) * **Description:** Catalog of ERC-1155 Multi Token contracts (EIP-1155); one contract can have many token types. * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/ERC1155-Tokens-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0203_erc1155_tokens_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/ERC1155-Tokens-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0203_erc1155_tokens_v1.json?download=true) ## Parameters Target EVM network. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.* #### Range Filters (mutually exclusive) Starting block number (inclusive) for the query. Use with `to_block`. Ending block number (inclusive) for the query. Use with `from_block`. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Use with `to_timestamp`. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. Use with `from_timestamp`. Validation rule:\ You must provide **either** a block range, a time range, or an explicit contract address filter.\ Providing more than one option results in HTTP 400.\ Providing none results in HTTP 400. #### Contract Address Filter Specific ERC-1155 token contract address to return (hex string, 20 bytes, no `0x` prefix). #### Pagination Controls Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Pagination cursor from a prior call. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Filter parameters echoed from the request (contract addresses, pagination state, etc.). #### Data Each element matches the linked dataset (no `chain_id` column — use `meta.chain_id`). Unique contract incarnation ID (26 bytes hex). Disambiguates redeployed contracts at the same address. The Ethereum contract address of the ERC-1155 multi-token contract. Block number of the contract recognition event. Block timestamp joined from the blocks table for easier selection and grouping. Transaction index within the genesis block. Contract name from `name()` (optional in EIP-1155). Contract symbol from `symbol()` (optional in EIP-1155). Contract decimals from `decimals()` (optional in EIP-1155). URI from `uri(uint256)` (optional ERC1155Metadata\_URI). Clients replace `{id}` with token ID in hex (64 chars). Whether the contract supports the ERC1155Metadata\_URI extension; null when detection was via fallback. Row-level lineage hash (hex string, no `0x` prefix). Lineage references of immediate parents. Record creation timestamp, e.g. `"2025-11-11T18:42:15.123Z"`. Last update timestamp in the same format. #### Envelope Fields Cursor token for pagination. Number of records returned in `data`. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/entities/tokens/erc1155" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z", "contract_address": "495f947276749ce646f68ac8c248420045cb7b5e" }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"from_block\":12345678,\"to_block\":12345999,\"contract_address\":\"495f947276749ce646f68ac8c248420045cb7b5e\"}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/entities/tokens/erc1155"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"from_block\":12345678,\"to_block\":12345999,\"contract_address\":\"495f947276749ce646f68ac8c248420045cb7b5e\"}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/entities/tokens/erc1155", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/entities/tokens/erc1155", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={ 'chain_id': 1, 'from_block': 12345678, 'to_block': 12345999, 'from_timestamp': '2025-10-29T00:00:00Z', 'to_timestamp': '2025-11-11T00:00:00Z', 'contract_address': '495f947276749ce646f68ac8c248420045cb7b5e' } ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/entities/tokens/erc1155", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ chain_id: 1, from_block: 12345678, to_block: 12345999, from_timestamp: "2025-10-29T00:00:00Z", to_timestamp: "2025-11-11T00:00:00Z", contract_address: "495f947276749ce646f68ac8c248420045cb7b5e" }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "contract_address": "495f947276749ce646f68ac8c248420045cb7b5e" }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/entities/tokens/erc1155", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "request_window": { "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z" }, "resolved_window": { "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z" }, "filters": { "contract_address": "495f947276749ce646f68ac8c248420045cb7b5e" } }, "data": [ { "contract_id": "495f947276749ce646f68ac8c248420045cb7b5e000000000000", "contract_address": "495f947276749ce646f68ac8c248420045cb7b5e", "block_number": 11579209, "block_time": "2021-10-15T12:00:00Z", "tx_index": 42, "name": "OpenSea Shared Storefront", "symbol": "OPENSTORE", "decimals": null, "uri": "https://api.opensea.io/api/v1/metadata/{id}", "supports_metadata_uri": true, "_tracing_id": "0203000000000000000000000000000000000001", "_parent_tracing_ids": [ "0103000000000000000000000000000000000001" ], "_created_at": "2025-11-11T18:42:15.123Z", "_updated_at": "2025-11-11T18:42:15.123Z" } ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer contract addresses" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Tokens · ERC-20 Source: https://docs.blockdb.io/api-reference/evm/entities/tokens-erc20 POST https://api.blockdb.io/v1/evm/entities/tokens/erc20 Discover ERC-20 tokens with metadata, supply, and compliance fields. ## Overview * **Dataset ID:** [`0201 - ERC-20 Tokens`](/data-catalog/evm/entities/erc20-tokens) * **Description:** Catalog of ERC-20 token contracts (EIP-20). * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/ERC20-Tokens-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0201_erc20_tokens_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/ERC20-Tokens-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0201_erc20_tokens_v1.json?download=true) ## Parameters Target EVM network. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.* #### Range Filters (mutually exclusive) Starting block number (inclusive) for the query. Use with `to_block`. Ending block number (inclusive) for the query. Use with `from_block`. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Use with `to_timestamp`. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. Use with `from_timestamp`. Validation rule:\ You must provide **either** a block range, a time range, or an explicit contract address filter.\ Providing more than one option results in HTTP 400.\ Providing none results in HTTP 400. #### Contract Address Filter Specific ERC-20 token contract address to return (hex string, 20 bytes, no `0x` prefix). #### Pagination Controls Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Pagination cursor from a prior call. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Filter parameters echoed from the request (contract addresses, pagination state, etc.). #### Data Array of token objects. Unique contract incarnation ID (26 bytes hex). Disambiguates redeployed contracts at the same address. The Ethereum contract address of the token. Block number where the token record was first recognized. Block timestamp joined from the `blocks` table for easier selection and grouping. Transaction index within the genesis block. Token name from `name()` (optional in EIP-20). Token symbol from `symbol()` (optional in EIP-20). Token decimals from `decimals()` (optional in EIP-20). Row-level lineage hash (hex string, no `0x` prefix). Lineage references of immediate parents. Record creation timestamp, e.g. `"2025-11-11T18:42:15.123Z"`. Last update timestamp in the same format. #### Envelope Fields Cursor token for pagination. Number of records returned in `data`. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/entities/tokens/erc20" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z", "contract_address": "1234567890abcdef1234567890abcdef12345678" }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"from_block\":12345678,\"to_block\":12345999,\"from_timestamp\":\"2025-10-29T00:00:00Z\",\"to_timestamp\":\"2025-11-11T00:00:00Z\",\"contract_address\":\"1234567890abcdef1234567890abcdef12345678\"}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/entities/tokens/erc20"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"from_block\":12345678,\"to_block\":12345999,\"from_timestamp\":\"2025-10-29T00:00:00Z\",\"to_timestamp\":\"2025-11-11T00:00:00Z\",\"contract_address\":\"1234567890abcdef1234567890abcdef12345678\"}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/entities/tokens/erc20", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/entities/tokens/erc20", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={'contract_address': '1234567890abcdef1234567890abcdef12345678', 'chain_id': 1, 'from_block': 12345678, 'from_timestamp': '2025-10-29T00:00:00Z', 'to_block': 12345999, 'to_timestamp': '2025-11-11T00:00:00Z'} ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/entities/tokens/erc20", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z", "contract_address": "1234567890abcdef1234567890abcdef12345678" }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z", "contract_address": "1234567890abcdef1234567890abcdef12345678" }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/entities/tokens/erc20", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "request_window": { "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z" }, "resolved_window": { "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z" }, "filters": { "contract_address": "1234567890abcdef1234567890abcdef12345678" } }, "data": [ { "contract_id": "0000000000000000000000000000000000000001000000000000", "contract_address": "0000000000000000000000000000000000000001", "block_number": 567890, "block_time": "2018-07-07T12:34:56Z", "tx_index": 4, "name": "Token Name", "symbol": "TOKEN", "decimals": 18, "_tracing_id": "0201000000000000000000000000000000000001", "_parent_tracing_ids": [ "0103000000000000000000000000000000000001", "0103000000000000000000000000000000000002" ], "_created_at": "2025-11-11T18:42:15.123Z", "_updated_at": "2025-11-11T18:42:15.123Z" } ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or contract addresses" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, # configured rate limit "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Tokens · ERC-721 Source: https://docs.blockdb.io/api-reference/evm/entities/tokens-erc721 POST https://api.blockdb.io/v1/evm/entities/tokens/erc721 Discover ERC-721 (NFT) token collections with metadata and provenance fields. ## Overview * **Dataset ID:** [`0202 - ERC-721 Tokens`](/data-catalog/evm/entities/erc721-tokens) * **Description:** Catalog of ERC-721 NFT collection contracts (EIP-721). * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/ERC721-Tokens-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0202_erc721_tokens_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/ERC721-Tokens-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0202_erc721_tokens_v1.json?download=true) ## Parameters Target EVM network. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.* #### Range Filters (mutually exclusive) Starting block number (inclusive) for the query. Use with `to_block`. Ending block number (inclusive) for the query. Use with `from_block`. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Use with `to_timestamp`. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. Use with `from_timestamp`. Validation rule:\ You must provide **either** a block range, a time range, or an explicit contract address filter.\ Providing more than one option results in HTTP 400.\ Providing none results in HTTP 400. #### Contract Address Filter Specific ERC-721 token contract address to return (hex string, 20 bytes, no `0x` prefix). #### Pagination Controls Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Pagination cursor from a prior call. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Filter parameters echoed from the request (contract addresses, pagination state, etc.). #### Data Each element matches the linked dataset (no `chain_id` column — use `meta.chain_id`). Unique contract incarnation ID (26 bytes hex). Disambiguates redeployed contracts at the same address. The Ethereum contract address of the token collection. Block number of the collection-creation event. Block timestamp joined from the blocks table for easier selection and grouping. Transaction index within the genesis block. Collection name from `name()` (ERC721Metadata, optional). Collection symbol from `symbol()` (ERC721Metadata, optional). Representative token URI or base URI for collection metadata (ERC721Metadata), if any. Whether the contract supports the ERC721Metadata extension; null when detection was via fallback. Whether the contract supports the ERC721Enumerable extension; null when detection was via fallback. Row-level lineage hash (hex string, no `0x` prefix). Lineage references of immediate parents. Record creation timestamp, e.g. `"2025-11-11T18:42:15.123Z"`. Last update timestamp in the same format. #### Envelope Fields Cursor token for pagination. Number of records returned in `data`. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/entities/tokens/erc721" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z", "contract_address": "bc4ca0eda7647a8ab7c2061c2e118a18a936f13d" }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"from_block\":12345678,\"to_block\":12345999,\"contract_address\":\"bc4ca0eda7647a8ab7c2061c2e118a18a936f13d\"}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/entities/tokens/erc721"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"from_block\":12345678,\"to_block\":12345999,\"contract_address\":\"bc4ca0eda7647a8ab7c2061c2e118a18a936f13d\"}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/entities/tokens/erc721", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/entities/tokens/erc721", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={ 'chain_id': 1, 'from_block': 12345678, 'to_block': 12345999, 'from_timestamp': '2025-10-29T00:00:00Z', 'to_timestamp': '2025-11-11T00:00:00Z', 'contract_address': 'bc4ca0eda7647a8ab7c2061c2e118a18a936f13d' } ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/entities/tokens/erc721", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ chain_id: 1, from_block: 12345678, to_block: 12345999, from_timestamp: "2025-10-29T00:00:00Z", to_timestamp: "2025-11-11T00:00:00Z", contract_address: "bc4ca0eda7647a8ab7c2061c2e118a18a936f13d" }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "contract_address": "bc4ca0eda7647a8ab7c2061c2e118a18a936f13d" }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/entities/tokens/erc721", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "request_window": { "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z" }, "resolved_window": { "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z" }, "filters": { "contract_address": "bc4ca0eda7647a8ab7c2061c2e118a18a936f13d" } }, "data": [ { "contract_id": "bc4ca0eda7647a8ab7c2061c2e118a18a936f13d000000000000", "contract_address": "bc4ca0eda7647a8ab7c2061c2e118a18a936f13d", "block_number": 12287507, "block_time": "2021-04-22T23:43:17Z", "tx_index": 114, "name": "BoredApeYachtClub", "symbol": "BAYC", "token_uri": "ipfs://QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/", "supports_metadata": true, "supports_enumerable": true, "_tracing_id": "0202000000000000000000000000000000000001", "_parent_tracing_ids": [ "0103000000000000000000000000000000000001" ], "_created_at": "2025-11-11T18:42:15.123Z", "_updated_at": "2025-11-11T18:42:15.123Z" } ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer collections or contract addresses" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Flash Loan Prints Source: https://docs.blockdb.io/api-reference/evm/flash-loans/flash-loan-prints POST https://api.blockdb.io/v1/evm/flash-loans/prints Read flash loan borrow/repay events (dataset 0305) with raw amounts and pool or vault attribution. ## Overview * **Dataset ID:** [`0305 - Flash Loan Prints`](/data-catalog/evm/flash-loans/flash-loan-prints) * **Description:** One row per borrowed token per on-chain flash loan event (V2-style flash swap, V3 Flash event, Balancer V2 Vault, etc.). `pool_uid` is NULL for vault-level events not tied to a single pool. * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/Flash-Loan-Prints-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0305_flash_loan_prints_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/Flash-Loan-Prints-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0305_flash_loan_prints_v1.json?download=true) ## Parameters Target EVM network. *See the [Chain](/api-reference/enumerations/chain) enumeration.* #### Range filters (mutually exclusive) Starting block number (inclusive). Use with `to_block`. Ending block number (inclusive). Use with `from_block`. Starting timestamp (ISO-8601). Use with `to_timestamp`. Ending timestamp (ISO-8601). Use with `from_timestamp`. Provide **either** a block range **or** a time range **or** direct selectors (`pool_uids`, `flash_loan_source_addresses`, and/or `token_addresses`).\ Do not mix block and timestamp ranges. Invalid combinations return HTTP 400. #### Direct selectors Filter to pool UIDs (32-byte hex, no `0x`). Omitted or null `pool_uid` rows (vault-level) require other selectors if you need them. Emitter contracts (20-byte hex, no `0x`): pool or vault that emitted the event. Borrowed token addresses (20-byte hex, no `0x`). #### Pagination Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Opaque pagination cursor from a previous response. #### Decimals-Adjusted Amounts Off by default. When set to `true`, the response includes `data.amount_borrowed`, `data.amount_repaid`, and `data.fee_amount` (decimals-adjusted, may be `null`) alongside the raw integer fields. Enabling it adds a per-request ERC-20 decimals lookup (extra join) that increases latency, so it is opt-in; when omitted or `false`, those fields are returned as `null` and only the always-present `*_raw` fields are populated. ## Response fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Echo of selectors and pagination from the request. #### Data Flash loan print records matching the request. Block height of the event. UTC timestamp of the block. Transaction index within the block. Log index within the transaction. 32-byte internal pool id (hex), or `null` for vault-level flash loans. Present when `pool_uid` is set; otherwise `null`. Pool type id when `pool_uid` is set; otherwise `null`. 20-byte address of the contract that emitted the event (hex, no `0x`). 20-byte ERC-20 token borrowed in this row (hex, no `0x`). Raw amount borrowed as a `uint256` integer in the borrowed token's smallest denomination. String-encoded. Decimals-adjusted form of `amount_borrowed_raw` (resolved against `token`). `null` when decimals are unknown or `include_adjusted_amounts=false`. Raw amount repaid (borrowed + fee) as a `uint256` integer in the borrowed token's smallest denomination. Decimals-adjusted form of `amount_repaid_raw`. Same null semantics as `amount_borrowed`. Raw fee: `amount_repaid_raw − amount_borrowed_raw`, in the borrowed token's smallest denomination. Decimals-adjusted form of `fee_amount_raw`. Same null semantics as `amount_borrowed`. Row tracing id (hex, no `0x`). Parent tracing ids. Record creation timestamp (ISO-8601). Record last update timestamp (ISO-8601). #### Envelope Pagination cursor. Number of rows in `data`. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/flash-loans/prints" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "from_block": 19000000, "to_block": 19000100, "limit": 50 }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"from_block\":19000000,\"to_block\":19000100,\"limit\":50}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/flash-loans/prints"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"from_block\":19000000,\"to_block\":19000100,\"limit\":50}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/flash-loans/prints", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/flash-loans/prints", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={"chain_id": 1, "from_block": 19000000, "to_block": 19000100, "limit": 50} ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/flash-loans/prints", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "from_block": 19000000, "to_block": 19000100, "limit": 50 }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "from_block": 19000000, "to_block": 19000100, "limit": 50 }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/flash-loans/prints", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "request_window": { "from_block": 19000000, "to_block": 19000100, "from_timestamp": null, "to_timestamp": null }, "resolved_window": { "from_block": 19000000, "to_block": 19000100, "from_timestamp": null, "to_timestamp": null }, "filters": { "pool_uids": [], "flash_loan_source_addresses": [], "token_addresses": [], "limit": 50, "cursor": null } }, "data": [ { "block_number": 19000050, "block_time": "2025-11-11T10:00:00Z", "tx_index": 12, "log_index": 3, "pool_uid": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000", "exchange_id": 1, "type_id": 201, "flash_loan_source": "88e6a0c2ddd26feeb64f039a2c41296fcb3f564", "token": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "amount_borrowed_raw": "1000000000000000000", "amount_borrowed": "1", "amount_repaid_raw": "1003000000000000000", "amount_repaid": "1.003", "fee_amount_raw": "3000000000000000", "fee_amount": "0.003", "_tracing_id": "0305c0ffee000000000000000000000000000000000000000000000000000001", "_parent_tracing_ids": [ "0103c0ffee000000000000000000000000000000000000000000000000000001" ], "_created_at": "2025-11-11T10:00:05Z", "_updated_at": "2025-11-11T10:00:05Z" } ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or contract addresses" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Flash Loans Overview Source: https://docs.blockdb.io/api-reference/evm/flash-loans/overview Query flash loan borrow and repay prints across DEX pools and vault-level sources. ## Overview Flash loan datasets capture on-chain flash loan events: amounts borrowed and repaid, fee, and attribution to a pool (`pool_uid`) or vault contract (`flash_loan_source` when `pool_uid` is null). ### Endpoint matrix | Endpoint | Summary | Dataset ID | | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------- | ---------- | | [`POST /evm/flash-loans/prints`](/api-reference/evm/flash-loans/flash-loan-prints) | Per-event flash loan prints (one row per borrowed token per log) | `0305` | ### Related * [Data catalog: Flash loan prints](/data-catalog/evm/flash-loans/flash-loan-prints) * [Dataset ID](/api-reference/enumerations/dataset-id) # Lineage Overview Source: https://docs.blockdb.io/api-reference/evm/lineage/overview Understand lineage traversal patterns before hitting record endpoints. ## Overview The lineage suite lets you reconstruct how a BlockDB record was produced. Each endpoint focuses on a specific slice of the lineage graph so you can tune limits, caching, and latency budgets independently. ### Endpoint Matrix | Endpoint | Summary | Default Limit | Typical Latency | | ----------------------------------------------------------------- | -------------------------------------------------------- | ------------- | --------------- | | [`POST /evm/lineage/record`](/api-reference/evm/lineage/record) | Fetch the latest copy of a record by tracing identifier. | `1` | \< 200 ms | | [`POST /evm/lineage/parents`](/api-reference/evm/lineage/parents) | Traverse the dependency graph of parent records. | `128` nodes | up to 1 s | ### Parameter Conventions Chain identifier to disambiguate networks. Refer to the [Chain](/api-reference/enumerations/chain) enumeration for supported values. Selector for lineage requests (hex string (no `0x` prefix)). Matches values emitted in `_tracing_id` fields. Pagination cursor returned from prior responses; persist per endpoint when traversing large graphs. Maximum number of records to return per page; lower values help manage payload size on expansive graphs. ### Usage Guidance * Start with `/evm/lineage/record` to confirm that a `tracing_id` exists before requesting heavier expansions. A missing record comes back as `200 OK` with `"data": null`, so check `data` rather than the status code. * Apply conservative `limit` settings when exploring new datasets; payload size grows with artifact volume and graph breadth. * Cache lineage responses client-side where possible—records are immutable once written. * Monitor `truncation_reason` (when present) to detect when depth or fan-out limits stop traversal. ### See Also * [`POST /evm/lineage/record`](/api-reference/evm/lineage/record) * [`POST /evm/lineage/parents`](/api-reference/evm/lineage/parents) # Lineage Parents Source: https://docs.blockdb.io/api-reference/evm/lineage/parents POST https://api.blockdb.io/v1/evm/lineage/parents Traverse upstream dependencies for any traced record. ## Overview Traverses the upstream dependency graph of the supplied record. Each node includes relationship metadata so you can follow the chain of derivations to a configurable depth. ## Parameters Target EVM network. Anchor record whose parents should be returned, provided as a hex string (no `0x` prefix). #### Traversal Controls Number of hops to follow. `1` returns direct parents, `2` includes grandparents, etc. Requests exceeding the configured maximum are truncated with a `truncation_reason`. When `true`, each returned node is hydrated with its full `record` (the same payload the [record endpoint](/api-reference/evm/lineage/record) returns). Only the nodes on the returned page are hydrated. Leave `false` to keep traversal responses small. #### Pagination Controls Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Opaque pagination cursor returned from a prior call. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. Tracing identifier for the record whose parents are returned. #### Data Each element represents a parent node that matches the requested depth and relationship filters. Dataset namespace for the parent record. Lineage identifier for the parent record (hex string, no `0x` prefix). Feed this back into other lineage endpoints to continue traversal. Tracing identifier of the record one hop closer to the queried record that this node is a direct parent of. For `depth: 1` nodes this equals `meta.tracing_id`. Combine with `relationship` to rebuild the lineage tree edge by edge (this node is the `` of `child_tracing_id`). How this node relates to its `child_tracing_id` (e.g., `source_log`, `pool_metadata`, `dependency`). Hop count from the original record (`1` for direct parents). Full row for the node, in the same shape as the [record endpoint](/api-reference/evm/lineage/record)'s `data.record`. Present only when the request sets `include_record: true`; omitted otherwise. #### Envelope Fields Pagination cursor for fetching additional parents. Number of parent nodes returned in `data`. Non-null when the server stopped traversal due to max depth, fan-out limits, or other safety guards. ### Next Steps * Fetch each parent's full record via [`/evm/lineage/record`](/api-reference/evm/lineage/record). ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/lineage/parents" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "tracing_id": "0301000000000000000000000000000000000001", "max_depth": 3, "cursor": null, "limit": 128 }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"tracing_id\":\"0301000000000000000000000000000000000001\",\"max_depth\":3,\"cursor\":null,\"limit\":128}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/lineage/parents"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"tracing_id\":\"0301000000000000000000000000000000000001\",\"max_depth\":3,\"cursor\":null,\"limit\":128}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/lineage/parents", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/lineage/parents", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={'chain_id': 1, 'cursor': None, 'limit': 128, 'max_depth': 3, 'tracing_id': '0301000000000000000000000000000000000001'} ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/lineage/parents", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "tracing_id": "0301000000000000000000000000000000000001", "max_depth": 3, "cursor": null, "limit": 128 }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "tracing_id": "0301000000000000000000000000000000000001", "max_depth": 3, "cursor": null, "limit": 128 }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/lineage/parents", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "tracing_id": "0301000000000000000000000000000000000001" }, "data": [ { "dataset": "blockdb_evm.0103_logs_v1", "_tracing_id": "0103000000000000000000000000000000000001", "child_tracing_id": "0301000000000000000000000000000000000001", "relationship": "source_log", "depth": 1 }, { "dataset": "blockdb_evm.0211_liquidity_pools_v1", "_tracing_id": "0211000000000000000000000000000000000002", "child_tracing_id": "0301000000000000000000000000000000000001", "relationship": "pool_metadata", "depth": 1 }, { "dataset": "blockdb_evm.0102_transactions_v1", "_tracing_id": "0102000000000000000000000000000000000003", "child_tracing_id": "0103000000000000000000000000000000000001", "relationship": "source_transaction", "depth": 2 } ], "cursor": "next_cursor", "page_count": 3, "truncation_reason": null } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or exchanges" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, # configured rate limit "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Lineage Record Source: https://docs.blockdb.io/api-reference/evm/lineage/record POST https://api.blockdb.io/v1/evm/lineage/record Fetch canonical records directly by tracing identifier. ## Overview Retrieves the canonical BlockDB representation of a single record, keyed by its lineage identifier. This is the lightweight entry point before requesting heavier parent expansions. ## Parameters EVM network identifier. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.* Lineage identifier for the target record (hex string, no `0x` prefix). The legacy `_tracing_id` key is still accepted. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. Tracing identifier for the record whose artifacts are returned. #### Data Envelope containing the record payload. `null` when no record matches the supplied `tracing_id` (the response is still `200 OK`, not `404`). A lookup that finds no matching record returns `200 OK` with `"data": null` (with `meta` still echoed), consistent with how list endpoints return an empty range. A `404`/`400` is only returned for malformed requests (missing `chain_id`, missing/short `tracing_id`, or an unknown dataset-id prefix). Dataset namespace that owns the record (e.g., `0201_tokens-erc20`). Snapshot of the dataset-specific fields for this record. Binary columns (addresses, hashes, tracing ids) are returned as bare lowercase hex — no `0x` and no Postgres `\x` prefix. Common metadata includes: Network identifier copied from the envelope. Dataset-specific primary key (illustrated here with a token contract address). Canonical block height where the record last changed. ISO-8601 timestamp for the block that produced the record state. Transaction position for provenance auditing when applicable. Log position for provenance auditing when applicable. Internal variant of `tracing_id`. Internal variant mirrored for completeness. Internal created-at timestamp. Internal updated-at timestamp. * **`name`**, **`symbol`**, **`decimals`**\ Dataset fields shown for the ERC-20 example. Actual shape varies per dataset—consult the dataset's schema docs. ### Next Steps * Chain into [`/evm/lineage/parents`](/api-reference/evm/lineage/parents) to traverse upstream derived records. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/lineage/record" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "tracing_id": "0201000000000000000000000000000000000001" }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"tracing_id\":\"0201000000000000000000000000000000000001\"}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/lineage/record"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"tracing_id\":\"0201000000000000000000000000000000000001\"}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/lineage/record", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/lineage/record", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={'chain_id': 1, 'tracing_id': '0201000000000000000000000000000000000001'} ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/lineage/record", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "tracing_id": "0201000000000000000000000000000000000001" }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "tracing_id": "0201000000000000000000000000000000000001" }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/lineage/record", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "tracing_id": "0201000000000000000000000000000000000001" }, "data": { "dataset": "blockdb_evm.b0201_erc20_tokens_v1", "record": { "chain_id": 1, "address": "0000000000000000000000000000000000000001", "name": "Token Name", "symbol": "TOKEN", "decimals": 18, "block_number": 567890, "block_time": "2018-07-07T12:34:56Z", "tx_index": 4, "log_index": 2, "_tracing_id": "0201000000000000000000000000000000000001", "_parent_tracing_ids": [ "0103000000000000000000000000000000000001", "0103000000000000000000000000000000000002" ], "_created_at": "2025-11-11T18:42:15.123Z", "_updated_at": "2025-11-11T18:42:15.123Z" } } } ``` ```json 200 (not found) theme={null} { "meta": { "chain_id": 1, "tracing_id": "0201000000000000000000000000000000000001" }, "data": null } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or exchanges" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, # configured rate limit "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Endpoints Overview Source: https://docs.blockdb.io/api-reference/evm/overview Index of BlockDB EVM REST endpoints, paths, and dataset IDs. ## How to use this page * Click through to full parameter and response documentation per endpoint. * Dataset IDs match [Dataset ID](/api-reference/enumerations/dataset-id) and WebSocket `dataset_id` values. ## Quick reference | Category | Endpoint | Summary | Dataset ID | | --------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------ | ---------- | | Account & Usage | [`GET /usage`](/api-reference/account-and-usage/usage) | Usage and rate limits | — | | Lineage | [`POST /evm/lineage/record`](/api-reference/evm/lineage/record) | Record by tracing id | — | | Lineage | [`POST /evm/lineage/parents`](/api-reference/evm/lineage/parents) | Parent dependency graph | — | | Verification | [`POST /evm/verify/receipt-root`](/api-reference/evm/verification/verify-receipt-root) | Receipt trie root check | — | | Verification | [`POST /evm/verify/logs-bloom`](/api-reference/evm/verification/verify-logs-bloom) | Logs bloom filter check | — | | Primitives | [`POST /evm/raw/blocks-summary`](/api-reference/evm/primitives/blocks-summary) | Block range aggregates | — | | Primitives | [`POST /evm/raw/blocks`](/api-reference/evm/primitives/blocks) | Block headers | `0101` | | Primitives | [`POST /evm/raw/transactions`](/api-reference/evm/primitives/transactions) | Transactions | `0102` | | Primitives | [`POST /evm/raw/logs`](/api-reference/evm/primitives/logs) | Event logs | `0103` | | Primitives | [`POST /evm/raw/internal-transactions`](/api-reference/evm/primitives/internal-transactions) | Call traces | `0111` | | Primitives | [`POST /evm/raw/contracts`](/api-reference/evm/primitives/contracts) | Contract deployments | `0121` | | Primitives | [`POST /evm/raw/function-results`](/api-reference/evm/primitives/function-results) | Function call results | `0122` | | JSON-RPC | [`POST /evm/rpc`](/api-reference/evm/rpc/overview) | Proxied JSON-RPC calls | — | | Entities | [`POST /evm/entities/tokens/erc20`](/api-reference/evm/entities/tokens-erc20) | ERC-20 registry | `0201` | | Entities | [`POST /evm/entities/tokens/erc721`](/api-reference/evm/entities/tokens-erc721) | ERC-721 registry | `0202` | | Entities | [`POST /evm/entities/tokens/erc1155`](/api-reference/evm/entities/tokens-erc1155) | ERC-1155 registry | `0203` | | Entities | [`POST /evm/entities/pools`](/api-reference/evm/entities/pools) | Liquidity pools | `0211` | | Entities | [`POST /evm/entities/pools/fee-terms`](/api-reference/evm/entities/fee-terms) | Pool fee terms | `0212` | | Reserves | [`POST /evm/reserves`](/api-reference/evm/reserves/reserves) | Pool reserves (+ details join) | `0301` | | Prices | [`POST /evm/prices/spot/crypto/prints`](/api-reference/evm/prices/crypto/prices-spot-prints) | Swap prints | `0302` | | Swaps | [`POST /evm/swaps/fees`](/api-reference/evm/swaps/swap-fees) | Swap fees | `0303` | | Transfers | [`POST /evm/transfers/token-transfers`](/api-reference/evm/transfers/token-transfers) | Token transfers | `0304` | | Flash loans | [`POST /evm/flash-loans/prints`](/api-reference/evm/flash-loans/flash-loan-prints) | Flash loan prints | `0305` | | Prices | [`POST /evm/prices/spot/crypto/ohlc`](/api-reference/evm/prices/crypto/prices-spot-ohlc) | Token-to-token OHLC | `0404` | | Prices | [`POST /evm/prices/spot/crypto/vwap`](/api-reference/evm/prices/crypto/prices-spot-vwap) | Token-to-token VWAP | `0405` | | Prices | [`POST /evm/prices/spot/crypto/vwap-aggregate`](/api-reference/evm/prices/crypto/prices-spot-vwap-aggregate) | Cross-pool VWAP (all venues) | `0505` | | Prices | [`POST /evm/prices/spot/fiat/vwap`](/api-reference/evm/prices/fiat/prices-spot-vwap-fiat) | Token-to-USD VWAP | `0605` | | Yields | [`POST /evm/yields`](/api-reference/evm/yields/yields) | Pool yields | `0411` | | TVL | [`POST /evm/tvl`](/api-reference/evm/tvl/tvl-usd) | Pool TVL USD | `0701` | | Arbitrage | [`POST /evm/arb/paths`](/api-reference/evm/arbitrage/arb-paths) | Arb path definitions | `0801` | | Arbitrage | [`POST /evm/arb/path-status`](/api-reference/evm/arbitrage/arb-path-status) | Arb path status | `0802` | | Arbitrage | [`POST /evm/arb/opportunities`](/api-reference/evm/arbitrage/arb-opportunities) | Arb opportunities | `0901` | ## Where to start * Raw ledger data: [Primitives](/api-reference/evm/primitives/overview). Block aggregates: [Blocks summary](/api-reference/evm/primitives/blocks-summary). Provenance: [Lineage](/api-reference/evm/lineage/overview). Integrity checks: [Verification](/api-reference/evm/verification/overview). Node passthrough: [JSON-RPC](/api-reference/evm/rpc/overview). * Tokens and pools: [Entities](/api-reference/evm/entities/overview). * Pricing: [Prices](/api-reference/evm/prices/overview). * Delivery and keys: [Authorization](/api-reference/overview/authorization). # Pricing Suite · Crypto Overview Source: https://docs.blockdb.io/api-reference/evm/prices/crypto/overview Swap prints, OHLC bars, and VWAP windows for ERC-20 pairs on EVM chains. ## Overview Crypto spot endpoints read datasets **`0302`** ([swap prints](/data-catalog/evm/prices/token-to-token-prices-swap-prints)), **`0404`** ([OHLC](/data-catalog/evm/prices/token-to-token-prices-ohlc)), and **`0405`** ([VWAP](/data-catalog/evm/prices/token-to-token-vwap)). Buckets use `bucket_seconds` ∈ as documented in those catalogs. ### Endpoint matrix | Endpoint | Summary | Dataset ID | | ------------------------------------------------------------------------------------------------------------ | ------------------------ | ---------- | | [`POST /evm/prices/spot/crypto/prints`](/api-reference/evm/prices/crypto/prices-spot-prints) | Realized swap executions | `0302` | | [`POST /evm/prices/spot/crypto/ohlc`](/api-reference/evm/prices/crypto/prices-spot-ohlc) | OHLC bars | `0404` | | [`POST /evm/prices/spot/crypto/vwap`](/api-reference/evm/prices/crypto/prices-spot-vwap) | VWAP bars (per pool) | `0405` | | [`POST /evm/prices/spot/crypto/vwap-aggregate`](/api-reference/evm/prices/crypto/prices-spot-vwap-aggregate) | VWAP bars (cross-pool) | `0505` | ### Conventions Target EVM chain. Use `pool_uids`, `token_in` / `token_out` (or equivalent address fields per endpoint), `exchange_ids`, and time or block ranges as documented on each page. Binary address and id fields are hex strings without `0x` in JSON. ### Pagination [Pagination & Limits](/api-reference/overview/pagination-and-limits). ### See also * [Dataset ID](/api-reference/enumerations/dataset-id) * [Token-to-token OHLC catalog](/data-catalog/evm/prices/token-to-token-prices-ohlc) # Prices · Spot OHLC Source: https://docs.blockdb.io/api-reference/evm/prices/crypto/prices-spot-ohlc POST https://api.blockdb.io/v1/evm/prices/spot/crypto/ohlc Pull time-bucketed OHLC bars from executed swap prices per pool. ## Overview * **Dataset ID:** [`0404 - Token-to-Token OHLC`](/data-catalog/evm/prices/token-to-token-prices-ohlc) * **Description:** Time-bucketed OHLC bars (1m..1d) per pool and token pair direction. * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/Token-Prices-OHLC-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0404_token_to_token_prices_ohlc_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/Token-Prices-OHLC-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0404_token_to_token_prices_ohlc_v1.json?download=true) ## Parameters Target EVM chain. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.* ERC-20 contract address for the base asset (hex string, 20 bytes, no `0x` prefix). ERC-20 contract address for the quote asset (hex string, 20 bytes, no `0x` prefix). #### Range Filters (mutually exclusive) Starting block (inclusive). Block ranges use **strict containment**: only buckets whose entire span maps to blocks within `[from_block, to_block]` are returned, so each bar aggregates only blocks inside your range. The partial bucket that merely contains `from_block` (and also spans earlier blocks) is excluded. A range narrower than one `bucket_seconds` returns no bars. Use with `to_block`. Ending block (inclusive). The partial bucket that contains `to_block` (and also spans later blocks) is excluded — only buckets ending at or before `to_block`'s timestamp are returned. Use with `from_block`. Window start (ISO-8601, inclusive). Used directly as `bucket_start >= from_timestamp`. Use with `to_timestamp`. Window end (ISO-8601, inclusive). Buckets with `bucket_end <= to_timestamp` are included. Use with `from_timestamp`. Provide **either** a block range (`from_block` + `to_block`) **or** a time range (`from_timestamp` + `to_timestamp`), not both. Omitting both is HTTP 400. #### Direct Selectors Filter by exchange identifiers. *See the [DigitalExchange](/api-reference/enumerations/digital-exchange) enumeration.* Restrict to specific BlockDB pool identifiers. #### Candle Controls Candle width in seconds. Allowed values: `60`, `300`, `900`, `1800`, `3600`, `14400`, `86400`. Gap-fill: one row per pool per bucket in the requested window. Gap buckets LOCF the last `close` (flat candle: open=high=low=close), with zero volumes and `trades_count=0`. Eligible pools have at least one bar for this pair and `bucket_seconds` on or before the window end (same `0404` table). LOCF seeds from the last bar before the window start when available, then from in-window bars. Works with a timestamp or block range (blocks resolve to timestamps, then align to bucket boundaries). #### Pagination Controls Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Opaque pagination cursor supplied by a previous response. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. ERC-20 contract address of the base asset, echoed from the request. ERC-20 contract address of the quote asset, echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Filter parameters echoed from the request. #### Data OHLC candles matching the request; each object uses the same field names as [`0404`](/data-catalog/evm/prices/token-to-token-prices-ohlc). When `dense=true`, one row is returned per pool per bucket for every bucket in the requested window. BlockDB pool identifier for the candle. Exchange/DEX identifier. Pool type identifier. Inclusive UTC start of the candle bucket (ISO-8601). Exclusive UTC end of the candle bucket (ISO-8601). Equal to `bucket_start + bucket_seconds`. Bucket width in seconds: `60`, `300`, `900`, `1800`, `3600`, `14400`, or `86400`. Opening price for the bucket (`quote_token_address` per 1 `base_token_address`, decimals-adjusted). `null` only when no prior bar exists for this pool, pair, and `bucket_seconds` before the window ends. Highest price within the bucket. `null` under the same condition as `open`. Lowest price within the bucket. `null` under the same condition as `open`. Closing price for the bucket. In dense mode, gap buckets LOCF the last `close` (including pre-window bars). `null` only when no LOCF seed exists. Sum of raw UInt256 `amountIn` values. `"0"` for carry-forward buckets in dense mode. Decimal-adjusted base (`base_token_address`) volume. `null` when token decimals are unknown. `"0"` for carry-forward buckets in dense mode when decimals are known. Sum of raw UInt256 `amountOut` values. `"0"` for carry-forward buckets in dense mode. Decimal-adjusted quote (`quote_token_address`) volume. `null` when token decimals are unknown. `"0"` for carry-forward buckets in dense mode when decimals are known. Trade count in the bucket. `0` for carry-forward buckets in dense mode. First block number in the chain-wide bucket. Populated when `dense=true`; `null` in sparse mode. Last block number in the chain-wide bucket. Populated when `dense=true`; `null` in sparse mode. Timestamp of the first block in the chain-wide bucket (ISO-8601). Populated when `dense=true`; `null` in sparse mode. Timestamp of the last block in the chain-wide bucket (ISO-8601). Populated when `dense=true`; `null` in sparse mode. Block count in the chain-wide bucket. Populated when `dense=true`; `null` in sparse mode. BlockDB tracing ID (hex, no `0x` prefix). `null` for synthetic gap-fill rows when `dense=true`. Tracing IDs of contributing swap prints; optional. `null` for gap-fill rows and by default. Record creation timestamp (ISO-8601). `null` for gap-fill rows. Record update timestamp (ISO-8601). `null` for gap-fill rows. #### Envelope Fields Pagination cursor. Number of candles returned in this page. ### Usage Notes * Pair direction is `meta.base_token_address` → `meta.quote_token_address` (`token_in` → `token_out`). Row objects do not repeat token addresses. * For USD-denominated VWAP buckets, use [`/evm/prices/spot/fiat/vwap`](/api-reference/evm/prices/fiat/prices-spot-vwap-fiat) instead of this endpoint. * Each row is one pool's candle for one bucket. Use `pool_uids` or `exchange_ids` to narrow results. * `dense=true` works with a timestamp or block range. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/prices/spot/crypto/ohlc" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "quote_token_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "from_timestamp": "2025-11-11T00:00:00Z", "to_timestamp": "2025-11-11T01:00:00Z", "exchange_ids": [1, 2], "bucket_seconds": 60, "dense": false, "limit": 200, "cursor": null }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"base_token_address\":\"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\",\"quote_token_address\":\"a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\"from_timestamp\":\"2025-11-11T00:00:00Z\",\"to_timestamp\":\"2025-11-11T01:00:00Z\",\"exchange_ids\":[1,2],\"bucket_seconds\":60,\"dense\":false,\"limit\":200,\"cursor\":null}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/prices/spot/crypto/ohlc"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"base_token_address\":\"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\",\"quote_token_address\":\"a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\"from_timestamp\":\"2025-11-11T00:00:00Z\",\"to_timestamp\":\"2025-11-11T01:00:00Z\",\"exchange_ids\":[1,2],\"bucket_seconds\":60,\"dense\":false,\"limit\":200,\"cursor\":null}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/prices/spot/crypto/ohlc", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests payload = { "chain_id": 1, "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "quote_token_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "from_timestamp": "2025-11-11T00:00:00Z", "to_timestamp": "2025-11-11T01:00:00Z", "exchange_ids": [1, 2], "bucket_seconds": 60, "dense": False, "limit": 200, "cursor": None } response = requests.post( "https://api.blockdb.io/v1/evm/prices/spot/crypto/ohlc", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json=payload ) print(response.json()) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/prices/spot/crypto/ohlc", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "quote_token_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "from_timestamp": "2025-11-11T00:00:00Z", "to_timestamp": "2025-11-11T01:00:00Z", "exchange_ids": [1, 2], "bucket_seconds": 60, "dense": false, "limit": 200, "cursor": null }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "quote_token_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "from_timestamp": "2025-11-11T00:00:00Z", "to_timestamp": "2025-11-11T01:00:00Z", "exchange_ids": [1, 2], "bucket_seconds": 60, "dense": false, "limit": 200, "cursor": null }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/prices/spot/crypto/ohlc", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "quote_token_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "request_window": { "from_block": null, "to_block": null, "from_timestamp": "2025-11-11T00:00:00Z", "to_timestamp": "2025-11-11T01:00:00Z" }, "resolved_window": { "from_block": null, "to_block": null, "from_timestamp": "2025-11-11T00:00:00Z", "to_timestamp": "2025-11-11T01:00:00Z" }, "filters": { "exchange_ids": [1, 2], "pool_uids": null, "bucket_seconds": 60, "dense": false } }, "data": [ { "pool_uid": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000", "exchange_id": 1, "type_id": 201, "bucket_start": "2025-11-11T00:00:00.000Z", "bucket_end": "2025-11-11T00:01:00.000Z", "bucket_seconds": 60, "open": "3010.112233445566778899", "high": "3033.998877665544332211", "low": "3008.001122334455667788", "close": "3025.219821481234567890", "volume_base_raw": "420000000000000000000", "volume_base": "420.000000000000000000", "volume_quote_raw": "1269000000000", "volume_quote": "1269000.000000000000000000", "trades_count": 128, "block_bucket_first_block_number": null, "block_bucket_last_block_number": null, "block_bucket_first_block_timestamp": null, "block_bucket_last_block_timestamp": null, "block_bucket_block_count": null, "_tracing_id": "0404000000000000000000000000000000000001", "_parent_tracing_ids": null, "_created_at": "2025-11-11T01:00:05.000Z", "_updated_at": "2025-11-11T01:00:05.000Z" } ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or exchanges" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, # configured rate limit "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Prices · Spot Prints Source: https://docs.blockdb.io/api-reference/evm/prices/crypto/prices-spot-prints POST https://api.blockdb.io/v1/evm/prices/spot/crypto/prints Retrieve executed swap prints (realized token_in → token_out price & sizes) from on-chain swap events. ## Overview * **Dataset ID:** [`0302 - Token-to-Token Swap Prints`](/data-catalog/evm/prices/token-to-token-prices-swap-prints) * **Description:** Executed swap prints (realized token\_in → token\_out price & sizes) per on-chain swap event. * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/Swap-Prints-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0302_token_to_token_prices_swap_prints_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/Swap-Prints-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0302_token_to_token_prices_swap_prints_v1.json?download=true) ## Parameters Target EVM chain. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.* ERC-20 contract address for the base asset (hex string, 20 bytes, no `0x` prefix). ERC-20 contract address for the quote asset (hex string, 20 bytes, no `0x` prefix). #### Range Filters (mutually exclusive) Starting block number (inclusive) for the query. Use with `to_block`. Ending block number (inclusive) for the query. Use with `from_block`. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Use with `to_timestamp`. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. Use with `from_timestamp`. Validation rule:\ You must provide **either** a block range, a time range, or at least one direct selector.\ Providing more than one option results in HTTP 400.\ Providing none results in HTTP 400. #### Direct Selectors Filter by exchange identifiers. *See the [DigitalExchange](/api-reference/enumerations/digital-exchange) enumeration.* Restrict to specific BlockDB pool identifiers. #### Pagination Controls Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Opaque pagination cursor supplied by a previous response. #### Decimals-Adjusted Amounts Off by default. When set to `true`, the response includes `data.amount_in` and `data.amount_out` (decimals-adjusted, may be `null`) alongside the raw integer fields. Enabling it adds a per-request ERC-20 decimals lookup (extra join) that increases latency, so it is opt-in; when omitted or `false`, those fields are returned as `null` and only the always-present `*_raw` fields are populated. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. ERC-20 contract address of the base asset, echoed from the request. ERC-20 contract address of the quote asset, echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Filter parameters echoed from the request. #### Data Swap print records matching the request. BlockDB pool identifier where the swap occurred. Exchange/DEX identifier. Pool type identifier. Block height where the swap event was observed. UTC timestamp of the block containing the swap. Zero-based transaction index within the block. Zero-based log index within the transaction. 20-byte address of the input token (direction of trade). 20-byte address of the output token for this swap direction. Amount of `token_in` executed in the swap, as a raw integer in the token's smallest denomination. String-encoded to preserve `uint256` precision. Decimals-adjusted form of `amount_in_raw` (`amount_in_raw / 10^decimals`). `null` when the input token's decimals are unknown or when `include_adjusted_amounts=false`. Amount of `token_out` received in the swap, as a raw integer in the token's smallest denomination. String-encoded to preserve `uint256` precision. Decimals-adjusted form of `amount_out_raw`. `null` when the output token's decimals are unknown or when `include_adjusted_amounts=false`. Realized execution price: `token_out` per 1 `token_in` (decimals-adjusted). May be `null`. Tracing identifier for the swap print record (hex string, no `0x` prefix). Parent lineage references (hex strings, no `0x` prefix). Record creation timestamp (ISO-8601). Record update timestamp (ISO-8601). #### Envelope Fields Pagination cursor. Number of swap print entries returned. ### Usage Notes * Swap prints represent historical execution outcomes, not forward-looking quotes * Each print corresponds to a single on-chain swap event with directional pair information * Use `exec_price` to analyze realized slippage and execution quality * Filter by `pool_uids` to compare execution prices across different AMM pools * The `token_in` and `token_out` fields define the swap direction; reverse the pair to see the opposite direction ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/prices/spot/crypto/prints" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "quote_token_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "from_block": 18930000, "to_block": 18939999, "exchange_ids": [ 1, 2 ], "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "limit": 250, "cursor": null }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"base_token_address\":\"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\",\"quote_token_address\":\"a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\"from_block\":18930000,\"to_block\":18939999,\"exchange_ids\":[2,3],\"pool_uids\":[\"88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000\"],\"limit\":250,\"cursor\":null}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/prices/spot/crypto/prints"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"base_token_address\":\"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\",\"quote_token_address\":\"a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\"from_block\":18930000,\"to_block\":18939999,\"exchange_ids\":[2,3],\"pool_uids\":[\"88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000\"],\"limit\":250,\"cursor\":null}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/prices/spot/crypto/prints", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/prices/spot/crypto/prints", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={ "chain_id": 1, "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "quote_token_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "from_block": 18930000, "to_block": 18939999, "exchange_ids": [2, 3], "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "limit": 250, "cursor": None } ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/prices/spot/crypto/prints", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "quote_token_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "from_block": 18930000, "to_block": 18939999, "exchange_ids": [ 1, 2 ], "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "limit": 250, "cursor": null }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "quote_token_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "from_block": 18930000, "to_block": 18939999, "exchange_ids": [ 1, 2 ], "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "limit": 250, "cursor": null }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/prices/spot/crypto/prints", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "quote_token_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "request_window": { "from_block": 18930000, "to_block": 18939999, "from_timestamp": null, "to_timestamp": null }, "resolved_window": { "from_block": 18930000, "to_block": 18939999, "from_timestamp": null, "to_timestamp": null }, "filters": { "exchange_ids": [ 1, 2 ], "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ] } }, "data": [ { "pool_uid": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000", "exchange_id": 1, "type_id": 201, "block_number": 18930123, "block_time": "2025-11-11T18:15:30.000Z", "tx_index": 5, "log_index": 12, "token_in": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "token_out": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "amount_in_raw": "10000000000000000000", "amount_in": "10", "amount_out_raw": "30241122334455667788990", "amount_out": "30241.12233445566778899", "exec_price": "3024.112233445566778899", "_tracing_id": "0302000000000000000000000000000000000001", "_parent_tracing_ids": [ "0203000000000000000000000000000000000000" ], "_created_at": "2025-11-11T18:15:35.000Z", "_updated_at": "2025-11-11T18:15:35.000Z" } ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or exchanges" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Prices · VWAP Source: https://docs.blockdb.io/api-reference/evm/prices/crypto/prices-spot-vwap POST https://api.blockdb.io/v1/evm/prices/spot/crypto/vwap Compute VWAP windows across specified asset-class pairs. ## Overview * **Dataset ID:** [`0405 - Token-to-Token VWAP`](/data-catalog/evm/prices/token-to-token-vwap) * **Description:** Volume-weighted average price (1m..1d) per pool and token pair direction. * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/Token-Prices-VWAP-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0405_token_to_token_vwap_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/Token-Prices-VWAP-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0405_token_to_token_vwap_v1.json?download=true) ## Parameters Target EVM chain. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.* ERC-20 contract address for the base asset (hex string, 20 bytes, no `0x` prefix). ERC-20 contract address for the quote asset (hex string, 20 bytes, no `0x` prefix). #### Range Filters (mutually exclusive) Starting block (inclusive). Block ranges use **strict containment**: only buckets whose entire span maps to blocks within `[from_block, to_block]` are returned, so each bar aggregates only blocks inside your range. The partial bucket that merely contains `from_block` (and also spans earlier blocks) is excluded. A range narrower than one `bucket_seconds` returns no bars. Use with `to_block`. Ending block (inclusive). The partial bucket that contains `to_block` (and also spans later blocks) is excluded — only buckets ending at or before `to_block`'s timestamp are returned. Use with `from_block`. Window start (ISO-8601, inclusive). Used directly as `bucket_start >= from_timestamp`. Use with `to_timestamp`. Window end (ISO-8601, inclusive). Buckets with `bucket_end <= to_timestamp` are included. Use with `from_timestamp`. Provide **either** a block range (`from_block` + `to_block`) **or** a time range (`from_timestamp` + `to_timestamp`), not both. Omitting both is HTTP 400. #### Direct Selectors Filter by exchange identifiers. *See the [DigitalExchange](/api-reference/enumerations/digital-exchange) enumeration.* Restrict to specific BlockDB pool identifiers. #### Bucket Controls Bucket width in seconds. Allowed values: `60`, `300`, `900`, `1800`, `3600`, `14400`, `86400`. Gap-fill: one row per pool per bucket in the requested window. Gap buckets LOCF the last `price_vwap`, with zero volumes and `trade_count=0`. Eligible pools have at least one bar for this pair and `bucket_seconds` on or before the window end (same `0405` table). LOCF seeds from the last bar before the window start when available, then from in-window bars. Works with a timestamp or block range (blocks resolve to timestamps, then align to bucket boundaries). #### Pagination Controls Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Opaque pagination cursor supplied by a previous response. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. ERC-20 contract address of the base asset, echoed from the request. ERC-20 contract address of the quote asset, echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Filter parameters echoed from the request. #### Data VWAP aggregates matching the request; each object uses the same field names as [`0405`](/data-catalog/evm/prices/token-to-token-vwap). BlockDB pool identifier. Exchange/DEX identifier. Pool type identifier. Inclusive UTC start of the VWAP bucket (ISO-8601). Exclusive UTC end of the VWAP bucket (ISO-8601). Equal to `bucket_start + bucket_seconds`. Bucket width in seconds: `60`, `300`, `900`, `1800`, `3600`, `14400`, or `86400`. Input token address (hex, 20 bytes, no `0x` prefix). Output token address (hex, 20 bytes, no `0x` prefix). VWAP (`token_out` per 1 `token_in`, decimals-adjusted). `null` only when no prior bar exists for this pool, pair, and `bucket_seconds` before the window ends. In dense mode, gap buckets LOCF the last price (including pre-window bars). Sum of raw UInt256 `amountIn` values. `"0"` for carry-forward buckets in dense mode. Decimal-adjusted `token_in` volume. `null` when token decimals are unknown. `"0"` for carry-forward buckets in dense mode when decimals are known. Sum of raw UInt256 `amountOut` values. `"0"` for carry-forward buckets in dense mode. Decimal-adjusted `token_out` volume. `null` when token decimals are unknown. `"0"` for carry-forward buckets in dense mode when decimals are known. Number of swaps in the bucket. `0` for carry-forward buckets in dense mode. First block number in the chain-wide bucket. Populated when `dense=true`; `null` in sparse mode. Last block number in the chain-wide bucket. Populated when `dense=true`; `null` in sparse mode. Timestamp of the first block in the chain-wide bucket (ISO-8601). Populated when `dense=true`; `null` in sparse mode. Timestamp of the last block in the chain-wide bucket (ISO-8601). Populated when `dense=true`; `null` in sparse mode. Block count in the chain-wide bucket. Populated when `dense=true`; `null` in sparse mode. BlockDB tracing ID (hex, no `0x` prefix). `null` for synthetic gap-fill rows when `dense=true`. Tracing IDs of contributing swap prints; optional. `null` for gap-fill rows and by default. Record creation timestamp (ISO-8601). `null` for gap-fill rows. Record update timestamp (ISO-8601). `null` for gap-fill rows. #### Envelope Fields Pagination cursor. Number of VWAP entries returned in this page. ### Usage Notes * For USD VWAP buckets, use [`/evm/prices/spot/fiat/vwap`](/api-reference/evm/prices/fiat/prices-spot-vwap-fiat) (`0605`). * For **cross-pool VWAP** (aggregated across venues/pools), use [`POST /evm/prices/spot/crypto/vwap-aggregate`](/api-reference/evm/prices/crypto/prices-spot-vwap-aggregate) (`0505`). * `dense=true` works with a timestamp or block range. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/prices/spot/crypto/vwap" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "quote_token_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "from_block": 18930000, "to_block": 18939999, "exchange_ids": [1, 2], "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "bucket_seconds": 3600, "dense": false, "limit": 200, "cursor": null }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"base_token_address\":\"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\",\"quote_token_address\":\"a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\"from_block\":18930000,\"to_block\":18939999,\"exchange_ids\":[1,2],\"pool_uids\":[\"88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000\"],\"bucket_seconds\":3600,\"dense\":false,\"limit\":200,\"cursor\":null}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/prices/spot/crypto/vwap"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"base_token_address\":\"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\",\"quote_token_address\":\"a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\"from_block\":18930000,\"to_block\":18939999,\"exchange_ids\":[1,2],\"pool_uids\":[\"88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000\"],\"bucket_seconds\":3600,\"dense\":false,\"limit\":200,\"cursor\":null}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/prices/spot/crypto/vwap", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/prices/spot/crypto/vwap", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={ "chain_id": 1, "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "quote_token_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "from_block": 18930000, "to_block": 18939999, "exchange_ids": [1, 2], "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "bucket_seconds": 3600, "dense": False, "limit": 200, "cursor": None } ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/prices/spot/crypto/vwap", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "quote_token_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "from_block": 18930000, "to_block": 18939999, "exchange_ids": [1, 2], "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "bucket_seconds": 3600, "dense": false, "limit": 200, "cursor": null }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "quote_token_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "from_block": 18930000, "to_block": 18939999, "exchange_ids": [1, 2], "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "bucket_seconds": 3600, "dense": false, "limit": 200, "cursor": null }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/prices/spot/crypto/vwap", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "quote_token_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "request_window": { "from_block": 18930000, "to_block": 18939999, "from_timestamp": null, "to_timestamp": null }, "resolved_window": { "from_block": 18930000, "to_block": 18939999, "from_timestamp": "2024-01-11T13:00:00Z", "to_timestamp": "2024-01-12T22:00:00Z" }, "filters": { "exchange_ids": [1, 2], "pool_uids": ["88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000"], "bucket_seconds": 3600, "dense": false } }, "data": [ { "pool_uid": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000", "exchange_id": 1, "type_id": 201, "bucket_start": "2025-11-11T18:00:00.000Z", "bucket_end": "2025-11-11T19:00:00.000Z", "bucket_seconds": 3600, "token_in": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "token_out": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "price_vwap": "3024.112233445566778899", "total_volume_in_raw": "580000000000000000000", "total_volume_in": "580.000000000000000000", "total_volume_out_raw": "1750000000000", "total_volume_out": "1750000.000000000000000000", "trade_count": 142, "block_bucket_first_block_number": null, "block_bucket_last_block_number": null, "block_bucket_first_block_timestamp": null, "block_bucket_last_block_timestamp": null, "block_bucket_block_count": null, "_tracing_id": "0405000000000000000000000000000000000001", "_parent_tracing_ids": null, "_created_at": "2025-11-11T19:00:05.000Z", "_updated_at": "2025-11-11T19:00:05.000Z" } ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or exchanges" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, # configured rate limit "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Prices · Cross-Pool VWAP Source: https://docs.blockdb.io/api-reference/evm/prices/crypto/prices-spot-vwap-aggregate POST https://api.blockdb.io/v1/evm/prices/spot/crypto/vwap-aggregate Compute cross-pool (cross-venue) VWAP windows aggregated across all pools and exchanges. ## Overview * **Dataset ID:** [`0505 - Token-to-Token Cross-Pool VWAP`](/data-catalog/evm/prices/token-to-token-cross-pool-vwap) * **Description:** Cross-venue VWAP bars (1m..1d) per token pair direction, aggregated from per-pool VWAP (`0405`) across all pools and exchanges. * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/Token-Prices-Cross-Pool-VWAP-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb0505_token_to_token_cross_pool_vwap_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/Token-Prices-Cross-Pool-VWAP-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb0505_token_to_token_cross_pool_vwap_v1.json?download=true) ## Parameters Target EVM chain. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.* ERC-20 contract address for the base asset (hex string, 20 bytes, no `0x` prefix). ERC-20 contract address for the quote asset (hex string, 20 bytes, no `0x` prefix). #### Range Filters (mutually exclusive) Starting block (inclusive). Block ranges use **strict containment**: only buckets whose entire span maps to blocks within `[from_block, to_block]` are returned, so each bar aggregates only blocks inside your range. The partial bucket that merely contains `from_block` (and also spans earlier blocks) is excluded. A range narrower than one `bucket_seconds` returns no bars. Use with `to_block`. Ending block (inclusive). The partial bucket that contains `to_block` (and also spans later blocks) is excluded — only buckets ending at or before `to_block`'s timestamp are returned. Use with `from_block`. Window start (ISO-8601, inclusive). Used directly as `bucket_start >= from_timestamp`. Use with `to_timestamp`. Window end (ISO-8601, inclusive). Buckets with `bucket_end <= to_timestamp` are included. Use with `from_timestamp`. Provide **either** a block range (`from_block` + `to_block`) **or** a time range (`from_timestamp` + `to_timestamp`), not both. Omitting both is HTTP 400. #### Bucket Controls Bucket width in seconds. Allowed values: `60`, `300`, `900`, `1800`, `3600`, `14400`, `86400`. Gap-fill: one row per bucket in the requested window. Gap buckets LOCF the last `price_vwap`, with zero volumes, `trade_count=0`, and `pool_count=0`. LOCF seeds from the last cross-pool bar before the window start when available, then from in-window bars (same `0505` table). Works with a timestamp or block range (blocks resolve to timestamps, then align to bucket boundaries). #### Pagination Controls Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Opaque pagination cursor supplied by a previous response. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. ERC-20 contract address of the base asset, echoed from the request. ERC-20 contract address of the quote asset, echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Filter parameters echoed from the request. #### Data Cross-pool VWAP aggregates matching the request; each object uses the same field names as [`0505`](/data-catalog/evm/prices/token-to-token-cross-pool-vwap). Inclusive UTC start of the VWAP bucket (ISO-8601). Exclusive UTC end of the VWAP bucket (ISO-8601). Equal to `bucket_start + bucket_seconds`. Bucket width in seconds: `60`, `300`, `900`, `1800`, `3600`, `14400`, or `86400`. Input token address (hex, 20 bytes, no `0x` prefix). Output token address (hex, 20 bytes, no `0x` prefix). Cross-venue VWAP (`quote_token_address` per 1 `base_token_address`, decimals-adjusted). `null` only when no prior bar exists for this pair and `bucket_seconds` before the window ends. In dense mode, gap buckets LOCF the last price (including pre-window bars). Sum of raw UInt256 `amountIn` values across all contributing pools. `"0"` for carry-forward buckets in dense mode. Decimal-adjusted `token_in` volume. `null` when token decimals are unknown. `"0"` for carry-forward buckets in dense mode when decimals are known. Sum of raw UInt256 `amountOut` values across all contributing pools. `"0"` for carry-forward buckets in dense mode. Decimal-adjusted `token_out` volume. `null` when token decimals are unknown. `"0"` for carry-forward buckets in dense mode when decimals are known. Total swaps across all contributing pools. `0` for carry-forward buckets in dense mode. Distinct pools that contributed to the bucket. `0` for carry-forward buckets in dense mode. First block number in the chain-wide bucket. Populated when `dense=true`; `null` in sparse mode. Last block number in the chain-wide bucket. Populated when `dense=true`; `null` in sparse mode. Timestamp of the first block in the chain-wide bucket (ISO-8601). Populated when `dense=true`; `null` in sparse mode. Timestamp of the last block in the chain-wide bucket (ISO-8601). Populated when `dense=true`; `null` in sparse mode. Block count in the chain-wide bucket. Populated when `dense=true`; `null` in sparse mode. BlockDB tracing ID (hex, no `0x` prefix). `null` for synthetic gap-fill rows when `dense=true`. Tracing IDs of contributing per-pool VWAP (`0405`) bars; optional. `null` for gap-fill rows and by default. Record creation timestamp (ISO-8601). `null` for gap-fill rows. Record update timestamp (ISO-8601). `null` for gap-fill rows. #### Envelope Fields Pagination cursor. Number of VWAP entries returned in this page. ### Usage Notes * For per-pool VWAP, use [`POST /evm/prices/spot/crypto/vwap`](/api-reference/evm/prices/crypto/prices-spot-vwap) (`0405`). * For USD VWAP buckets, use [`POST /evm/prices/spot/fiat/vwap`](/api-reference/evm/prices/fiat/prices-spot-vwap-fiat) (`0605`). * `dense=true` works with a timestamp or block range. * Responses are read from the pre-aggregated cross-pool dataset (`0505`). ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/prices/spot/crypto/vwap-aggregate" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "quote_token_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "from_block": 18930000, "to_block": 18939999, "bucket_seconds": 3600, "dense": false, "limit": 200, "cursor": null }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"base_token_address\":\"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\",\"quote_token_address\":\"a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\"from_block\":18930000,\"to_block\":18939999,\"bucket_seconds\":3600,\"dense\":false,\"limit\":200,\"cursor\":null}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/prices/spot/crypto/vwap-aggregate"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"base_token_address\":\"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\",\"quote_token_address\":\"a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\"from_block\":18930000,\"to_block\":18939999,\"bucket_seconds\":3600,\"dense\":false,\"limit\":200,\"cursor\":null}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/prices/spot/crypto/vwap-aggregate", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/prices/spot/crypto/vwap-aggregate", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={ "chain_id": 1, "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "quote_token_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "from_block": 18930000, "to_block": 18939999, "bucket_seconds": 3600, "dense": False, "limit": 200, "cursor": None } ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/prices/spot/crypto/vwap-aggregate", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "quote_token_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "from_block": 18930000, "to_block": 18939999, "bucket_seconds": 3600, "dense": false, "limit": 200, "cursor": null }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "quote_token_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "from_block": 18930000, "to_block": 18939999, "bucket_seconds": 3600, "dense": false, "limit": 200, "cursor": null }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/prices/spot/crypto/vwap-aggregate", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "quote_token_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "request_window": { "from_block": 18930000, "to_block": 18939999, "from_timestamp": null, "to_timestamp": null }, "resolved_window": { "from_block": 18930000, "to_block": 18939999, "from_timestamp": "2024-01-11T13:00:00Z", "to_timestamp": "2024-01-12T22:00:00Z" }, "filters": { "bucket_seconds": 3600, "dense": false } }, "data": [ { "bucket_start": "2025-11-11T18:00:00.000Z", "bucket_end": "2025-11-11T19:00:00.000Z", "bucket_seconds": 3600, "token_in": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "token_out": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "price_vwap": "3024.112233445566778899", "total_volume_in_raw": "580000000000000000000", "total_volume_in": "580.000000000000000000", "total_volume_out_raw": "1750000000000", "total_volume_out": "1750000.000000000000000000", "trade_count": 142, "pool_count": 23, "block_bucket_first_block_number": null, "block_bucket_last_block_number": null, "block_bucket_first_block_timestamp": null, "block_bucket_last_block_timestamp": null, "block_bucket_block_count": null, "_tracing_id": "0505000000000000000000000000000000000001", "_parent_tracing_ids": null, "_created_at": "2025-11-11T19:00:05.000Z", "_updated_at": "2025-11-11T19:00:05.000Z" } ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer exchanges" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Pricing Suite · Fiat Overview Source: https://docs.blockdb.io/api-reference/evm/prices/fiat/overview Token-to-USD VWAP in fixed time buckets. ## Overview The fiat VWAP endpoint reflects dataset **`0605`** — [Token-to-fiat VWAP](/data-catalog/evm/prices/token-to-fiat-vwap): USD price per ERC-20 token with lineage anchors and stablecoin-anchored routing metadata (`hops`, `sources_count`). ### Endpoint matrix | Endpoint | Summary | Dataset ID | | ----------------------------------------------------------------------------------------- | ------------------------- | ---------- | | [`POST /evm/prices/spot/fiat/vwap`](/api-reference/evm/prices/fiat/prices-spot-vwap-fiat) | Token-to-USD VWAP buckets | `0605` | ### Parameters Target EVM chain. ERC-20 address filter (hex, no `0x`), when applicable. Use block or time range filters per [Pagination & Limits](/api-reference/overview/pagination-and-limits) patterns on the VWAP page. ### See also * [Token-to-fiat VWAP catalog](/data-catalog/evm/prices/token-to-fiat-vwap) * [Fiat Currency](/api-reference/enumerations/fiat-currency) # Prices · VWAP (Fiat) Source: https://docs.blockdb.io/api-reference/evm/prices/fiat/prices-spot-vwap-fiat POST https://api.blockdb.io/v1/evm/prices/spot/fiat/vwap Compute fiat-denominated VWAP windows across specified asset pairs. ## Overview * **Dataset ID:** [`0605 - Token-to-Fiat VWAP (USD)`](/data-catalog/evm/prices/token-to-fiat-vwap) * **Description:** Token-to-USD VWAP (1m..1d) per token, derived from cross-pool token-to-token VWAP (dataset 0505) via stablecoin anchoring. * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/Token-To-Fiat-VWAP-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0605_token_to_fiat_vwap_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/Token-To-Fiat-VWAP-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0605_token_to_fiat_vwap_v1.json?download=true) ## Parameters Target EVM chain. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.* ERC-20 contract address for the base asset (hex string, 20 bytes, no `0x` prefix). Fiat currency code for the quote leg. #### Range Filters (mutually exclusive) Starting block (inclusive). Block ranges use **strict containment**: only buckets whose entire span maps to blocks within `[from_block, to_block]` are returned, so each bar aggregates only blocks inside your range. The partial bucket that merely contains `from_block` is excluded. A range narrower than one `bucket_seconds` returns no bars. Use with `to_block`. Ending block (inclusive). The partial bucket that contains `to_block` (and also spans later blocks) is excluded — only buckets ending at or before `to_block`'s timestamp are returned. Use with `from_block`. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. Validation rule:\ You must provide **either** a block range, a time range, or at least one direct selector.\ Providing more than one option results in HTTP 400.\ Providing none results in HTTP 400. #### Direct Selectors Filter by exchange identifiers. *See the [DigitalExchange](/api-reference/enumerations/digital-exchange) enumeration.* Restrict to specific BlockDB pool identifiers. #### Pagination Controls Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Opaque pagination cursor supplied by a previous response. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. ERC-20 contract address of the base asset, echoed from the request. Fiat currency code for the quote leg, echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Filters applied to the query (exchange IDs, pool UIDs). #### Data Fiat VWAP rows matching the request. On-chain lineage anchor: block of the first contributing event in the bucket window. Time of the first contributing event (ISO-8601). Transaction index of the first contributing event. Log index of the first contributing event. On-chain lineage anchor: block of the last contributing event in the bucket window. Time of the last contributing event (ISO-8601). Transaction index of the last contributing event. Log index of the last contributing event. Inclusive UTC start of the VWAP bucket (ISO-8601). Bucket width in seconds; one of `60`, `300`, `900`, `1800`, `3600`, `14400`, `86400`. ERC-20 token address (hex, 20 bytes, no `0x` prefix). VWAP in USD for the bucket. Returned as a string to preserve precision. Notional USD volume used in the VWAP weighting. Returned as a string to preserve precision. Minimum hop count from the stablecoin anchor along `b0505` edges. Number of cross-pool pair edges (`b0505` rows) used in the hop chain. BlockDB tracing ID for the row (hex string, no `0x` prefix); unique per row. Tracing IDs of contributing `b0505` VWAP lineage (each hex string without `0x`). Record creation timestamp (ISO-8601). Record update timestamp (ISO-8601). #### Envelope Fields Pagination cursor. Number of VWAP entries returned. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/prices/spot/fiat/vwap" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "quote_currency_code": "USD", "from_block": 18930000, "to_block": 18939999, "exchange_ids": [ 1, 2 ], "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "limit": 200, "cursor": null }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"base_token_address\":\"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\",\"quote_currency_code\":\"USD\",\"from_block\":18930000,\"to_block\":18939999,\"exchange_ids\":[2,3],\"pool_uids\":[\"88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000\"],\"limit\":200,\"cursor\":null}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type": "application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/prices/spot/fiat/vwap"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"base_token_address\":\"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\",\"quote_currency_code\":\"USD\",\"from_block\":18930000,\"to_block\":18939999,\"exchange_ids\":[2,3],\"pool_uids\":[\"88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000\"],\"limit\":200,\"cursor\":null}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/prices/spot/fiat/vwap", payload); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); } } ``` ```python Python theme={null} import os import requests payload = { "chain_id": 1, "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "quote_currency_code": "USD", "from_block": 18930000, "to_block": 18939999, "exchange_ids": [2, 3], "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ] } response = requests.post( "https://api.blockdb.io/v1/evm/prices/spot/fiat/vwap", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json=payload ) print(response.json()) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/prices/spot/fiat/vwap", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ chain_id: 1, base_token_address: "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", quote_currency_code: "USD", from_block: 18930000, to_block: 18939999, exchange_ids: [2, 3], pool_uids: [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], limit: 200, cursor: null }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "quote_currency_code": "USD", "from_block": 18930000, "to_block": 18939999, "exchange_ids": [ 1, 2 ], "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "limit": 200, "cursor": null }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/prices/spot/fiat/vwap", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "base_token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "quote_currency_code": "USD", "request_window": { "from_block": 18930000, "to_block": 18939999, "from_timestamp": null, "to_timestamp": null }, "resolved_window": { "from_block": 18930000, "to_block": 18939999, "from_timestamp": "2024-01-11T13:00:00Z", "to_timestamp": "2024-01-12T22:00:00Z" }, "filters": { "exchange_ids": [ 1, 2 ], "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ] } }, "data": [ { "first_block_number": 18930000, "first_block_time": "2025-11-11T18:00:11.000Z", "first_tx_index": 12, "first_log_index": 5, "last_block_number": 18939999, "last_block_time": "2025-11-11T18:59:48.000Z", "last_tx_index": 44, "last_log_index": 2, "bucket_start": "2025-11-11T18:00:00.000Z", "bucket_seconds": 3600, "token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "price_usd": "3024.112233445566778899", "total_notional_usd": "1750000.000000000000000000", "hops": 2, "sources_count": 4, "_tracing_id": "0605000000000000000000000000000000000001", "_parent_tracing_ids": [ "0505000000000000000000000000000000000001", "0505000000000000000000000000000000000002" ], "_created_at": "2025-11-11T19:00:05.000Z", "_updated_at": "2025-11-11T19:00:05.000Z" } ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or exchanges" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, # configured rate limit "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Blocks Source: https://docs.blockdb.io/api-reference/evm/primitives/blocks POST https://api.blockdb.io/v1/evm/raw/blocks Retrieve canonical EVM blocks with provenance and integrity metadata. ## Overview * **Dataset ID:** [`0101 - Blocks`](/data-catalog/evm/primitives/blocks) * **Description:** Canonical block headers with BlockDB integrity metadata. * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/Raw-Blocks-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0101_blocks_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/Raw-Blocks-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0101_blocks_v1.json?download=true) ## Parameters Target EVM network. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.* #### Range Filters (mutually exclusive) Starting block number (inclusive) for the query. Use with `to_block`. Ending block number (inclusive) for the query. Use with `from_block`. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Use with `to_timestamp`. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. Use with `from_timestamp`. Validation rule:\ You must provide **either** a block range, a time range, or explicit selectors.\ Providing more than one option (e.g., both ranges or ranges plus selectors) results in HTTP 400.\ Providing none results in HTTP 400. #### Direct Selectors Explicit set of block numbers. Mutually exclusive with `block_hashes`. Explicit set of block hashes (hex string, 32 bytes, no `0x` prefix). Mutually exclusive with `block_numbers`. #### Pagination Controls Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Opaque pagination cursor supplied by a previous response. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Filters echoed from the request (contract addresses, block numbers, limit). #### Data Array of block objects. Sequential block height. Keccak-256 hash of the block header (32 bytes, hex string, no `0x` prefix). Keccak-256 hash of the parent block (32 bytes, hex string, no `0x` prefix). Merkle root of transaction receipts (32 bytes). Fee recipient / coinbase address (20 bytes). Block gas limit. Extra data payload supplied by the miner (`<= 32` bytes, hex-encoded). Block size in bytes. Timestamp when the block was mined. Tracing identifier for the canonical block record (hex string, no `0x` prefix). Recomputed receipts root for BlockDB integrity checks. Timestamp when the receipts root was (re)computed. Record creation timestamp. Record last update timestamp. #### Envelope Fields Cursor token for pagination. Number of records returned in `data`. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/raw/blocks" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z", "block_numbers": [ 12345678, 12345679 ], "block_hashes": [ "7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0" ], "limit": 200, "cursor": null }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"from_block\":12345678,\"to_block\":12345999,\"from_timestamp\":\"2025-10-29T00:00:00Z\",\"to_timestamp\":\"2025-11-11T00:00:00Z\",\"block_numbers\":[12345678,12345679],\"block_hashes\":[\"7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0\"],\"limit\":200,\"cursor\":null}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/raw/blocks"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"from_block\":12345678,\"to_block\":12345999,\"from_timestamp\":\"2025-10-29T00:00:00Z\",\"to_timestamp\":\"2025-11-11T00:00:00Z\",\"block_numbers\":[12345678,12345679],\"block_hashes\":[\"7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0\"],\"limit\":200,\"cursor\":null}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/raw/blocks", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/raw/blocks", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={'block_hashes': ['7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0'], 'block_numbers': [12345678, 12345679], 'chain_id': 1, 'from_block': 12345678, 'from_timestamp': '2025-10-29T00:00:00Z', 'to_block': 12345999, 'to_timestamp': '2025-11-11T00:00:00Z', 'limit': 200, 'cursor': None} ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/raw/blocks", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z", "block_numbers": [ 12345678, 12345679 ], "block_hashes": [ "7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0" ], "limit": 200, "cursor": null }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z", "block_numbers": [ 12345678, 12345679 ], "block_hashes": [ "7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0" ], "limit": 200, "cursor": null }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/raw/blocks", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "request_window": { "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z" }, "resolved_window": { "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z" }, "filters": { "block_numbers": [ 12345678, 12345679 ], "block_hashes": [ "7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0" ] } }, "data": [ { "block_number": 12345678, "block_hash": "7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0", "parent_block_hash": "f78e26c5959a94d6a62ed3837f5dcecf0d3761bf0a502e12a08fd7bc44c8568d", "receipt_root": "b4d8cfe4b87590afe7ed95fbf7798142e8fb1ce86307ff0eb6580b8bc23de92f", "miner": "0000000000000000000000000000000000000000", "gas_limit": 30000000, "extra_data": "636c61737369635f657468657265756d", "size": 124836, "timestamp_utc": "2025-11-11T18:42:15.123Z", "_tracing_id": "010200000000000000000000000000000000", "_computed_receipt_root": "b4d8cfe4b87590afe7ed95fbf7798142e8fb1ce86307ff0eb6580b8bc23de92f", "_computed_receipt_timestamp_utc": "2025-11-11T18:43:00.000Z", "_created_at": "2025-11-11T18:42:15.123Z", "_updated_at": "2025-11-11T18:42:15.123Z" } ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or exchanges" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, # configured rate limit "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Blocks Summary Source: https://docs.blockdb.io/api-reference/evm/primitives/blocks-summary POST https://api.blockdb.io/v1/evm/raw/blocks-summary Aggregate throughput, fee, and usage metrics over block or time ranges. ## Overview * **Dataset ID:** [`0101 - Blocks`](/data-catalog/evm/primitives/blocks) * **Description:** Aggregated block metrics (gas, throughput, fees) over a range; derived from `blockdb_evm.b0101_blocks_v1`. This endpoint returns aggregated buckets, not raw block rows. * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/Raw-Blocks-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0101_blocks_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/Raw-Blocks-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0101_blocks_v1.json?download=true) ## Parameters Target EVM network. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.* #### Range Filters (mutually exclusive) Starting block number (inclusive) for the query. Use with `to_block`. Ending block number (inclusive) for the query. Use with `from_block`. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Use with `to_timestamp`. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. Use with `from_timestamp`. Validation rule:\ You must provide **either** a block range or a time range.\ Providing both results in HTTP 400.\ Providing neither results in HTTP 400. #### Aggregation Controls Adds a 10-bucket histogram for effective gas price distribution when `true`. Temporal grouping of the summary. Supported values: `"total"`, `"hour"`, `"day"`. #### Pagination Controls Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Pagination cursor from a prior call. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Other request knobs echoed back (fee histogram flag, bucket granularity). #### Data Buckets summarising the requested range. One element when `bucket_granularity` is `"total"`. ISO-8601 timestamp marking the start of the aggregation window. ISO-8601 timestamp marking the end of the aggregation window. Granularity echoed from the request. Total number of canonical blocks in the bucket. Smallest block number covered in the bucket. Largest block number covered in the bucket. Total transactions in the bucket. Successful transactions in the bucket. Failed transactions in the bucket. Distinct sender addresses observed. Distinct recipient addresses observed. Sum of gas used (wei) across all blocks in the bucket. Sum of gas limits (wei) across all blocks in the bucket. Minimum base fee per gas (wei). Maximum base fee per gas (wei). Average base fee per gas (wei). Average priority fee per gas (wei) for successful transactions. Nullable on unsupported chains. Total ETH burned via base fee (wei). Protocol-level issuance minus burned fees for the bucket (wei). Ten buckets covering the 0-100 percentile range when `include_fee_histogram` is `true`. Zero-based bucket index (0-9). Upper bound (exclusive) of the fee bucket (wei). Transactions in the fee bucket. #### Envelope Fields Pagination cursor for additional buckets when the range exceeds service limits. Number of bucket elements in `data`. ## Use Cases * Feed dashboards with pre-aggregated throughput metrics without ETL. * Detect fee regime shifts by polling hourly buckets. * Estimate unique user counts per epoch to complement raw transaction exports. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/raw/blocks-summary" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "from_block": 18900000, "to_block": 18900999, "from_timestamp": null, "to_timestamp": null, "include_fee_histogram": true, "bucket_granularity": "hour" }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"from_block\":18900000,\"to_block\":18900999,\"from_timestamp\":null,\"to_timestamp\":null,\"include_fee_histogram\":true,\"bucket_granularity\":\"hour\"}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/raw/blocks-summary"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"from_block\":18900000,\"to_block\":18900999,\"from_timestamp\":null,\"to_timestamp\":null,\"include_fee_histogram\":true,\"bucket_granularity\":\"hour\"}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/raw/blocks-summary", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/raw/blocks-summary", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={'bucket_granularity': 'hour', 'chain_id': 1, 'from_block': 18900000, 'from_timestamp': None, 'include_fee_histogram': True, 'to_block': 18900999, 'to_timestamp': None} ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/raw/blocks-summary", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "from_block": 18900000, "to_block": 18900999, "from_timestamp": null, "to_timestamp": null, "include_fee_histogram": true, "bucket_granularity": "hour" }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "from_block": 18900000, "to_block": 18900999, "from_timestamp": null, "to_timestamp": null, "include_fee_histogram": true, "bucket_granularity": "hour" }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/raw/blocks-summary", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "request_window": { "from_block": 18900000, "to_block": 18900999, "from_timestamp": null, "to_timestamp": null }, "resolved_window": { "from_block": 18900000, "to_block": 18900999, "from_timestamp": null, "to_timestamp": null }, "filters": { "include_fee_histogram": true, "bucket_granularity": "hour" } }, "data": [ { "bucket_start": "2025-11-11T00:00:00Z", "bucket_end": "2025-11-11T00:59:59Z", "bucket_granularity": "hour", "block_count": 300, "min_block_number": 18900000, "max_block_number": 18900299, "tx_count": 420000, "successful_tx_count": 405000, "failed_tx_count": 15000, "unique_senders": 128456, "unique_recipients": 98234, "gas_used": "9203456789000", "gas_limit": "9300000000000", "base_fee_per_gas_min": "2100000000", "base_fee_per_gas_max": "2300000000", "base_fee_per_gas_avg": "2195000000", "priority_fee_per_gas_avg": "1500000000", "burned_fees": "1932000000000000000", "net_issuance": "-1300000000000000000", "fee_histogram": [ { "bucket_index": 0, "max_effective_gas_price": "500000000", "tx_count": 42000 } ] } ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or exchanges" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, # configured rate limit "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Contracts Source: https://docs.blockdb.io/api-reference/evm/primitives/contracts POST https://api.blockdb.io/v1/evm/raw/contracts Access canonical contract metadata and deployment info for smart contracts discovered via CREATE/CREATE2 internal transactions. ## Overview * **Dataset ID:** [`0121 - Contracts`](/data-catalog/evm/primitives/contracts) * **Description:** Smart contracts discovered via CREATE/CREATE2 internal transactions. Uses `contract_id` (26 bytes = address + creation\_block + tx\_index) as primary key to support metamorphic contracts (e.g. CREATE-SELFDESTRUCT-CREATE2 in the same block). * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/Raw-Contracts-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0121_contracts_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/Raw-Contracts-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0121_contracts_v1.json?download=true) ## Parameters Target EVM network. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.* #### Range Filters (mutually exclusive with direct selectors) Starting block number (inclusive) for the query. Use with `to_block`. Ending block number (inclusive) for the query. Use with `from_block`. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Use with `to_timestamp`. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. Use with `from_timestamp`. Validation rule:\ You must provide **either** a block range, a time range, `block_numbers`, or `contract_addresses`.\ Providing both range selectors and explicit selectors results in HTTP 400.\ Providing none also results in HTTP 400. #### Direct Selectors Filter by specific deployed contract addresses (hex string, 20 bytes, no `0x` prefix). Up to 256 addresses per request. Explicit list of block heights to fetch contract deployments from. Mutually exclusive with the range filters. #### Pagination Controls Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Opaque pagination cursor supplied by a previous response. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Filters echoed from the request (contract addresses, block numbers, limit). #### Data Each element mirrors the table columns (chain implied by `meta.chain_id`). Unique contract incarnation ID (hex string, 26 bytes, no `0x` prefix): 20 bytes address + 4 bytes creation block + 2 bytes tx\_index. Use for metamorphic disambiguation and to join with function-results. Deployed contract address (hex string, 20 bytes, no `0x` prefix). Use for address-based lookups. Block height containing the contract creation. ISO-8601 UTC timestamp of the creation block, joined from the blocks dataset. Zero-based index of the deployment transaction within the block. Position in the call tree (e.g., `"0"`, `"0.0"`, `"0.1.2"`). Address that deployed the contract (msg.sender of CREATE/CREATE2). Hex string, 20 bytes, no `0x` prefix. Type of creation: `CREATE` or `CREATE2`. Internal tracing identifier for lineage tracking (hex string, no `0x` prefix). Timestamp when BlockDB materialized the record. Timestamp of the latest update to the record. #### Envelope Fields Pagination cursor to continue the query. Number of records in the current page. ## Use Cases * Look up the canonical creation block for a contract address before hydrating additional metadata. * Backfill on-chain analyses that require the deployment timestamp or transaction location. * Seed lineage exploration using `_tracing_id` to pivot into `/evm/logs` and `/evm/transactions`. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/raw/contracts" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "contract_addresses": [ "1234567890abcdef1234567890abcdef12345678" ], "block_numbers": [ 18934001, 18934222 ], "from_block": 18933000, "to_block": 18936000, "from_timestamp": null, "to_timestamp": null, "limit": 200, "cursor": null }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"contract_addresses\":[\"1234567890abcdef1234567890abcdef12345678\"],\"block_numbers\":[18934001,18934222],\"from_block\":18933000,\"to_block\":18936000,\"from_timestamp\":null,\"to_timestamp\":null,\"limit\":200,\"cursor\":null}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/raw/contracts"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"contract_addresses\":[\"1234567890abcdef1234567890abcdef12345678\"],\"block_numbers\":[18934001,18934222],\"from_block\":18933000,\"to_block\":18936000,\"from_timestamp\":null,\"to_timestamp\":null,\"limit\":200,\"cursor\":null}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/raw/contracts", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/raw/contracts", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={'block_numbers': [18934001, 18934222], 'chain_id': 1, 'contract_addresses': ['1234567890abcdef1234567890abcdef12345678'], 'cursor': None, 'from_block': 18933000, 'from_timestamp': None, 'limit': 200, 'to_block': 18936000, 'to_timestamp': None} ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/raw/contracts", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "contract_addresses": [ "1234567890abcdef1234567890abcdef12345678" ], "block_numbers": [ 18934001, 18934222 ], "from_block": 18933000, "to_block": 18936000, "from_timestamp": null, "to_timestamp": null, "limit": 200, "cursor": null }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "contract_addresses": [ "1234567890abcdef1234567890abcdef12345678" ], "block_numbers": [ 18934001, 18934222 ], "from_block": 18933000, "to_block": 18936000, "from_timestamp": null, "to_timestamp": null, "limit": 200, "cursor": null }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/raw/contracts", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "request_window": { "from_block": 18933000, "to_block": 18936000, "from_timestamp": null, "to_timestamp": null }, "resolved_window": { "from_block": 18933000, "to_block": 18936000, "from_timestamp": null, "to_timestamp": null }, "filters": { "contract_addresses": [ "1234567890abcdef1234567890abcdef12345678" ], "block_numbers": [ 18934001, 18934222 ] } }, "data": [ { "contract_id": "1234567890abcdef1234567890abcdef1234567800121a0700", "contract_address": "1234567890abcdef1234567890abcdef12345678", "block_number": 18934221, "block_time": "2024-04-01T12:34:56Z", "tx_index": 7, "trace_address": "0", "creator_address": "0000000000000000000000000000000000000000", "creation_call_type": "CREATE2", "_tracing_id": "0121000000000000000000000000000000000001", "_created_at": "2025-11-11T18:42:15.123Z", "_updated_at": "2025-11-11T18:42:15.123Z" } ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or exchanges" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, # configured rate limit "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Function Results Source: https://docs.blockdb.io/api-reference/evm/primitives/function-results POST https://api.blockdb.io/v1/evm/raw/function-results Read cached function execution outputs enriched with traces and gas usage. ## Overview * **Dataset ID:** [`0122 - Function Results`](/data-catalog/evm/primitives/function-results) * **Description:** On-chain function call return values versioned by block. Uses `contract_id` (26 bytes) to support metamorphic contracts; primary key is `(contract_id, block_number, call_data)`. * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/Raw-Function-Results-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0122_function_results_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/Raw-Function-Results-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0122_function_results_v1.json?download=true) ## Parameters Target EVM network. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.* #### Range Filters (mutually exclusive) Starting block number (inclusive) for the query. Use with `to_block`. Ending block number (inclusive) for the query. Use with `from_block`. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Use with `to_timestamp`. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. Use with `from_timestamp`. Validation rule:\ Every request must include a **bounding window** — either a block range (`from_block`/`to_block`) or a time range (`from_timestamp`/`to_timestamp`). The two ranges are mutually exclusive.\ `contract_addresses` and `signature_hashes` are **refinement filters only** and must be combined with a block or time range; they cannot be used on their own. function\_results is a very large partitioned table, and selectors are low-selectivity (a single hot selector such as `transfer()` matches a huge fraction of rows), so an unbounded selector scan would time out.\ Providing no bounding window results in HTTP 400. #### Refinement Filters Filter by 20-byte contract addresses (hex string, no `0x` prefix). Resolved to matching `contract_id` incarnations. Up to 256 entries. Requires a block or time range. 4-byte function selectors (8 hex characters, no `0x` prefix). Use to scope calls to specific function signatures. Requires a block or time range. #### Pagination Controls Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Opaque pagination cursor returned from a prior call. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Filters echoed from the request (contract addresses, signature hashes, latest\_only, limit). #### Data Function result records ordered by `(contract_id, block_number DESC)` unless `latest_only` is `true`. Each row matches the linked dataset; the first 20 bytes of `contract_id` are the deployed address — there is no separate `contract_address` field in the payload. Contract incarnation ID (hex string, 26 bytes, no `0x` prefix): 20 bytes address + 4 bytes creation block + 2 bytes tx index. Use to join with contracts or for metamorphic disambiguation. Snapshot block height when the value was observed. Block time for the snapshot (ISO-8601). Hex-encoded calldata sent to the contract. For simple getter functions, this is usually just the selector. 4-byte function selector (hex). Hex-encoded return payload, or `null`. Decode using the ABI corresponding to `signature_hash`. Observation timestamp (ISO-8601), aligned with the snapshot. Internal lineage identifier (hex string, no `0x` prefix) for cross-referencing with lineage endpoints. Record creation timestamp (ISO-8601). Record last update timestamp (ISO-8601). #### Envelope Fields Pagination cursor to continue the query. Number of records returned in this page. ## Use Cases * Refresh oracle or configuration caches with latest per-block values. * Detect contract parameter changes by diffing consecutive results. * Seed lineage exploration by pairing selectors with their upstream transactions and logs. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/raw/function-results" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "contract_addresses": [ "1234567890abcdef1234567890abcdef12345678" ], "signature_hashes": [ "0902f1ac" ], "from_block": 18934000, "to_block": 18935000, "from_timestamp": null, "to_timestamp": null, "latest_only": false, "limit": 200, "cursor": null }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"contract_addresses\":[\"1234567890abcdef1234567890abcdef12345678\"],\"signature_hashes\":[\"0902f1ac\"],\"from_block\":18934000,\"to_block\":18935000,\"from_timestamp\":null,\"to_timestamp\":null,\"latest_only\":false,\"limit\":200,\"cursor\":null}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/raw/function-results"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"contract_addresses\":[\"1234567890abcdef1234567890abcdef12345678\"],\"signature_hashes\":[\"0902f1ac\"],\"from_block\":18934000,\"to_block\":18935000,\"from_timestamp\":null,\"to_timestamp\":null,\"latest_only\":false,\"limit\":200,\"cursor\":null}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/raw/function-results", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/raw/function-results", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={'chain_id': 1, 'contract_addresses': ['1234567890abcdef1234567890abcdef12345678'], 'cursor': None, 'from_block': 18934000, 'from_timestamp': None, 'latest_only': False, 'limit': 200, 'signature_hashes': ['0902f1ac'], 'to_block': 18935000, 'to_timestamp': None} ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/raw/function-results", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "contract_addresses": [ "1234567890abcdef1234567890abcdef12345678" ], "signature_hashes": [ "0902f1ac" ], "from_block": 18934000, "to_block": 18935000, "from_timestamp": null, "to_timestamp": null, "latest_only": false, "limit": 200, "cursor": null }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "contract_addresses": [ "1234567890abcdef1234567890abcdef12345678" ], "signature_hashes": [ "0902f1ac" ], "from_block": 18934000, "to_block": 18935000, "from_timestamp": null, "to_timestamp": null, "latest_only": false, "limit": 200, "cursor": null }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/raw/function-results", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "request_window": { "from_block": 18934000, "to_block": 18935000, "from_timestamp": null, "to_timestamp": null }, "resolved_window": { "from_block": 18934000, "to_block": 18935000, "from_timestamp": null, "to_timestamp": null }, "filters": { "contract_addresses": [ "1234567890abcdef1234567890abcdef12345678" ], "signature_hashes": [ "0902f1ac" ], "latest_only": false } }, "data": [ { "contract_id": "1234567890abcdef1234567890abcdef1234567800121a0700", "block_number": 18934560, "block_time": "2024-04-01T12:34:56.000Z", "call_data": "0902f1ac", "signature_hash": "0902f1ac", "result": "0000000000000000000000000000000000000000000000000de0b6b3a7640000", "timestamp_utc": "2024-04-01T12:34:56.000Z", "_tracing_id": "0122000000000000000000000000000000000001", "_created_at": "2025-11-11T18:42:15.123Z", "_updated_at": "2025-11-11T18:42:15.123Z" } ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or exchanges" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, # configured rate limit "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Internal Transactions Source: https://docs.blockdb.io/api-reference/evm/primitives/internal-transactions POST https://api.blockdb.io/v1/evm/raw/internal-transactions Query internal transactions (call traces) from debug_traceTransaction with call type, value, gas, and revert data. **Not publicly available:** This dataset is not included in the standard public API. Request access via a custom plan — contact [support@blockdb.io](mailto:support@blockdb.io). ## Overview * **Dataset ID:** [`0111 - Internal Transactions`](/data-catalog/evm/primitives/internal-transactions) * **Description:** Internal transactions (call traces) from `debug_traceTransaction`. Response rows mirror `blockdb_evm.b0111_internal_transactions_v1` (hex strings without `0x` for `BYTEA` fields in JSON). * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/Raw-Internal-Transactions-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0111_internal_transactions_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/Raw-Internal-Transactions-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0111_internal_transactions_v1.json?download=true) ## Parameters Target EVM network. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.* #### Range Filters (mutually exclusive) Starting block number (inclusive) for the query. Use with `to_block`. Ending block number (inclusive) for the query. Use with `from_block`. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Use with `to_timestamp`. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. Use with `from_timestamp`. Validation rule:\ You must provide **either** a block range, a time range, or explicit selectors.\ Providing more than one option (e.g., both ranges or ranges plus selectors) results in HTTP 400.\ Providing none results in HTTP 400. #### Direct Selectors Explicit set of block numbers. Mutually exclusive with `tx_hashes`. Filter by parent transaction hash (hex string, 32 bytes, no `0x` prefix). Returns all call traces for those transactions. Mutually exclusive with `block_numbers`. #### Address & Type Filters Filter by caller address (hex string, 20 bytes, no `0x` prefix). Filter by callee address (hex string, 20 bytes, no `0x` prefix). Failed CREATE/CREATE2 may have null `to_address` and are excluded when this filter is present. Filter by call type: `CALL`, `DELEGATECALL`, `STATICCALL`, `CREATE`, `CREATE2`. Omit to return all types. Filter by underlying transaction success (`true` = success, `false` = reverted). Omit to return traces for both. #### Pagination Controls Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Pagination cursor from a prior call. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Filter parameters echoed from the request (addresses, call\_types, tx\_success, pagination state, etc.). #### Data Array of internal transaction (call trace) records, ordered by block, tx index, and trace address. Block number of the parent transaction. UTC timestamp of the block (ISO-8601). Zero-based index of the parent transaction within the block. Position in the call tree (e.g. `"0"`, `"0.0"`, `"0.1"`). One of: `CALL`, `DELEGATECALL`, `STATICCALL`, `CREATE`, `CREATE2`. Caller address (hex string, 20 bytes, no `0x` prefix). Callee address (hex string, 20 bytes); null for failed CREATE/CREATE2. Native value transferred in this call, in wei (string to preserve precision). Gas allocated for this call (string to preserve precision); null when disabled from indexing. Gas consumed by this call (string to preserve precision); null when disabled from indexing. Calldata for this call (hex string, no `0x` prefix); null when disabled from indexing. Return data from the call (hex string, no `0x` prefix when present); null when disabled from indexing or if the call reverted or return data is absent in the source trace. Error message if the call reverted; null otherwise. Success of the underlying parent transaction that produced this internal call. Internal tracing ID for observability (hex string, no `0x` prefix); unique per row. Record creation timestamp, e.g. `"2025-11-11T18:42:15.123Z"`. Last update timestamp in the same format. #### Envelope Fields Cursor token for pagination. Number of records returned in `data`. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/raw/internal-transactions" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "from_address": "0000000000000000000000000000000000000000", "to_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "call_types": ["CALL", "DELEGATECALL"], "tx_success": true, "limit": 250, "cursor": null }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"from_block\":12345678,\"to_block\":12345999,\"limit\":250,\"cursor\":null}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/raw/internal-transactions"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"from_block\":12345678,\"to_block\":12345999,\"limit\":250,\"cursor\":null}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/raw/internal-transactions", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/raw/internal-transactions", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "tx_hashes": ["7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0"], "call_types": ["CALL", "DELEGATECALL"], "limit": 250, "cursor": None } ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/raw/internal-transactions", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ chain_id: 1, from_block: 12345678, to_block: 12345999, tx_hashes: ["7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0"], call_types: ["CALL", "DELEGATECALL"], limit: 250, cursor: null }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "limit": 250, "cursor": null }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/raw/internal-transactions", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "request_window": { "from_block": 12345678, "to_block": 12345999, "from_timestamp": null, "to_timestamp": null }, "resolved_window": { "from_block": 12345678, "to_block": 12345999, "from_timestamp": null, "to_timestamp": null }, "filters": { "from_address": "0000000000000000000000000000000000000000", "to_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "call_types": [ "CALL", "DELEGATECALL" ], "tx_success": true, "limit": 250, "cursor": null } }, "data": [ { "block_number": 12345680, "block_time": "2025-10-29T00:01:23Z", "tx_index": 5, "trace_address": "0", "call_type": "CALL", "from_address": "0000000000000000000000000000000000000000", "to_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "value_wei": "1000000000000000000", "gas": null, "gas_used": null, "input": null, "output": null, "error": null, "tx_success": true, "_tracing_id": "0111000000000000000000000000000000000001", "_created_at": "2025-11-11T18:42:15.123Z", "_updated_at": "2025-11-11T18:42:15.123Z" }, { "block_number": 12345680, "block_time": "2025-10-29T00:01:23Z", "tx_index": 5, "trace_address": "0.1", "call_type": "DELEGATECALL", "from_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "to_address": "0000000000000000000000000000000000000001", "value_wei": "0", "gas": null, "gas_used": null, "input": null, "output": null, "error": null, "tx_success": true, "_tracing_id": "0111000000000000000000000000000000000002", "_created_at": "2025-11-11T18:42:15.123Z", "_updated_at": "2025-11-11T18:42:15.123Z" } ], "cursor": "next_page_cursor", "page_count": 2 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "body", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_block", "location": "body", "reason": "required_with", "expected": "provide either block range (from_block + to_block), time range (from_timestamp + to_timestamp), or tx_hashes / block_numbers" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by from_address, to_address, call_types, or tx_hashes" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Logs Source: https://docs.blockdb.io/api-reference/evm/primitives/logs POST https://api.blockdb.io/v1/evm/raw/logs Query decoded EVM log events with flexible topic filters. ## Overview * **Dataset ID:** [`0103 - Logs`](/data-catalog/evm/primitives/logs) * **Description:** Event logs emitted by contract transactions. * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/Raw-Logs-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0103_logs_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/Raw-Logs-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0103_logs_v1.json?download=true) ## Parameters Target EVM network. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.* #### Range Filters (mutually exclusive) Starting block number (inclusive) for the query. Use with `to_block`. Ending block number (inclusive) for the query. Use with `from_block`. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Use with `to_timestamp`. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. Use with `from_timestamp`. Validation rule:\ Every request must include at least one primary criterion: a block range (`from_block`/`to_block`), a time range (`from_timestamp`/`to_timestamp`), `block_numbers`, or `tx_hashes`. A block range and a time range are mutually exclusive, as are `block_numbers` and `tx_hashes`.\ `contract_addresses` and `topic_zeros` are **refinement filters** that require a **block range or time range** specifically — they cannot be used on their own, and a `block_numbers`/`tx_hashes` set does not satisfy this (an unbounded scan over a hot contract or topic would time out).\ Providing none of the above results in HTTP 400. #### Bounding Windows Explicit set of block numbers (a bounding window). Mutually exclusive with `tx_hashes`. Filter logs by parent transaction hash (hex string, 32 bytes, no `0x` prefix); a bounding window. Mutually exclusive with `block_numbers`. #### Contract & Topic Filters Filter by emitting contract address (hex string, 20 bytes, no `0x` prefix). Requires a block range or time range. Filter by the primary event topic. Anonymous events have `topic_zero = null`. Requires a block range or time range. #### Pagination Controls Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Opaque pagination cursor supplied by a previous response. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Filters echoed from the request (block numbers, tx hashes, contract addresses, topics). #### Data Each element mirrors the table columns (chain implied by `meta.chain_id`). Resolve transaction hash via `block_number` + `tx_index` and the transactions dataset if needed — there is no `tx_hash` column in SQL. Block height containing the log. Block timestamp joined from the `blocks` table for easier aggregation. Zero-based index of the parent transaction within the block. Position of the log within the transaction. Address of the emitting contract (20 bytes). Primary topic hash identifying the event (32 bytes). `null` for anonymous events. Subsequent event topics (`topics[1..n]`), each stored as a 32-byte hex string. Raw event data payload (hex string (no `0x` prefix)). Tracing identifier for the canonical transaction record (hex string, no `0x` prefix). Record creation timestamp. Record last update timestamp. #### Envelope Fields Cursor token for pagination. Number of records returned in `data`. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/raw/logs" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z", "block_numbers": [ 12345678, 12345679 ], "tx_hashes": [ "7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0" ], "contract_addresses": [ "0000000000000000000000000000000000000000" ], "topic_zeros": [ "ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" ], "limit": 200, "cursor": null }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"from_block\":12345678,\"to_block\":12345999,\"from_timestamp\":\"2025-10-29T00:00:00Z\",\"to_timestamp\":\"2025-11-11T00:00:00Z\",\"block_numbers\":[12345678,12345679],\"tx_hashes\":[\"7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0\"],\"contract_addresses\":[\"0000000000000000000000000000000000000000\"],\"topic_zeros\":[\"ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\"],\"limit\":200,\"cursor\":null}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/raw/logs"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"from_block\":12345678,\"to_block\":12345999,\"from_timestamp\":\"2025-10-29T00:00:00Z\",\"to_timestamp\":\"2025-11-11T00:00:00Z\",\"block_numbers\":[12345678,12345679],\"tx_hashes\":[\"7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0\"],\"contract_addresses\":[\"0000000000000000000000000000000000000000\"],\"topic_zeros\":[\"ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\"],\"limit\":200,\"cursor\":null}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/raw/logs", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/raw/logs", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={'block_numbers': [12345678, 12345679], 'chain_id': 1, 'contract_addresses': ['0000000000000000000000000000000000000000'], 'from_block': 12345678, 'from_timestamp': '2025-10-29T00:00:00Z', 'to_block': 12345999, 'to_timestamp': '2025-11-11T00:00:00Z', 'topic_zeros': ['ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'], 'tx_hashes': ['7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0'], 'limit': 200, 'cursor': None} ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/raw/logs", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z", "block_numbers": [ 12345678, 12345679 ], "tx_hashes": [ "7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0" ], "contract_addresses": [ "0000000000000000000000000000000000000000" ], "topic_zeros": [ "ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" ], "limit": 200, "cursor": null }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z", "block_numbers": [ 12345678, 12345679 ], "tx_hashes": [ "7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0" ], "contract_addresses": [ "0000000000000000000000000000000000000000" ], "topic_zeros": [ "ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" ], "limit": 200, "cursor": null }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/raw/logs", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "request_window": { "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z" }, "filters": { "block_numbers": [ 12345678, 12345679 ], "tx_hashes": [ "7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0" ], "contract_addresses": [ "0000000000000000000000000000000000000000" ], "topic_zeros": [ "ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" ] } }, "data": [ { "block_number": 12345678, "block_time": "2025-11-11T18:42:15.123Z", "tx_index": 4, "log_index": 0, "contract_address": "0000000000000000000000000000000000000000", "topic_zero": "ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "data_topics": [ "0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000001" ], "data": "00000000000000000000000000000000000000000000000000000000000003e8", "_tracing_id": "0103000000000000000000000000000000000000", "_created_at": "2025-11-11T18:42:15.123Z", "_updated_at": "2025-11-11T18:42:15.123Z" } ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or exchanges" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, # configured rate limit "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Raw Data Overview Source: https://docs.blockdb.io/api-reference/evm/primitives/overview Access canonical blockchain primitives: blocks, transactions, logs, contracts, and function results. ## Overview The Raw Data suite provides direct access to on-chain execution artifacts with cryptographic verification metadata. These endpoints deliver the foundational blockchain primitives that power all derived datasets. Each endpoint includes lineage fields (`_tracing_id`) that link records back to their on-chain origins. ### Endpoint Matrix | Endpoint | Summary | Dataset ID | Typical Latency | | -------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------- | --------------- | | [`POST /evm/raw/blocks`](/api-reference/evm/primitives/blocks) | Retrieve canonical EVM blocks with integrity metadata | `0101` | \< 200 ms | | [`POST /evm/raw/blocks-summary`](/api-reference/evm/primitives/blocks-summary) | Aggregated block metrics (gas, throughput, fees) over a range | — | \< 300 ms | | [`POST /evm/raw/transactions`](/api-reference/evm/primitives/transactions) | Executed transactions with gas accounting and lineage | `0102` | \< 200 ms | | [`POST /evm/raw/logs`](/api-reference/evm/primitives/logs) | Decoded event logs with topic filters | `0103` | \< 200 ms | | [`POST /evm/raw/contracts`](/api-reference/evm/primitives/contracts) | Contract deployment metadata (contract\_id, supports metamorphic) | `0121` | \< 200 ms | | [`POST /evm/raw/function-results`](/api-reference/evm/primitives/function-results) | Deterministic contract call outputs versioned by block (contract\_id) | `0122` | \< 250 ms | | [`POST /evm/raw/internal-transactions`](/api-reference/evm/primitives/internal-transactions) | Call traces (debug\_traceTransaction) with value, gas, and revert data | `0111` | \< 300 ms | ### Parameter Conventions Starting block height (inclusive) for range queries. Ending block height (inclusive) for range queries. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. Explicit list of block heights for precise lookups. Parent transaction hashes (hex string, 32 bytes, no `0x` prefix) for targeted retrievals. Block hashes (hex string, 32 bytes, no `0x` prefix) for exact matching. Contract addresses (hex string, 20 bytes, no `0x` prefix) to scope results to specific contracts. Chain identifier for the target EVM network. See [Chain enumeration](/api-reference/enumerations/chain) for supported values. Pagination cursor returned from previous responses. Maximum number of records to return. ### Usage Guidance * **Start with blocks** — Use `/evm/blocks` to establish time ranges before querying transactions or logs * **Batch array filters** — Prefer array filters (`block_numbers`, `tx_hashes`) over range queries for better performance * **Join via `_tracing_id`** — Use lineage identifiers to join across datasets (blocks → transactions → logs) * **Cache function-results** — Deterministic outputs are immutable; cache aggressively to reduce API calls ### Common Patterns **Get all transactions in a block:** ```json theme={null} { "chain_id": 1, "block_numbers": [ 12345678 ] } ``` **Find logs for specific event:** ```json theme={null} { "chain_id": 1, "topic_zeros": [ "ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" ], "from_timestamp": "2025-01-01T00:00:00Z", "to_timestamp": "2025-01-31T23:59:59Z" } ``` **Lookup contract deployment:** ```json theme={null} { "chain_id": 1, "contract_addresses": [ "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" ] } ``` ### See also * [`POST /evm/raw/blocks`](/api-reference/evm/primitives/blocks) — Block headers and integrity metadata * [`POST /evm/raw/transactions`](/api-reference/evm/primitives/transactions) — Transaction execution data * [`POST /evm/raw/logs`](/api-reference/evm/primitives/logs) — Event log emissions * [`POST /evm/raw/contracts`](/api-reference/evm/primitives/contracts) — Contract deployment records * [`POST /evm/raw/function-results`](/api-reference/evm/primitives/function-results) — Contract call outputs * [`POST /evm/raw/internal-transactions`](/api-reference/evm/primitives/internal-transactions) — Call traces (internal txs) # Transactions Source: https://docs.blockdb.io/api-reference/evm/primitives/transactions POST https://api.blockdb.io/v1/evm/raw/transactions Filter canonical transactions with execution metadata and gas accounting. ## Overview * **Dataset ID:** [`0102 - Transactions`](/data-catalog/evm/primitives/transactions) * **Description:** Transactions included in blocks. * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/Raw-Transactions-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0102_transactions_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/Raw-Transactions-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0102_transactions_v1.json?download=true) ## Parameters Target EVM network. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.* #### Range Filters (mutually exclusive) Starting block number (inclusive) for the query. Use with `to_block`. Ending block number (inclusive) for the query. Use with `from_block`. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Use with `to_timestamp`. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. Use with `from_timestamp`. Validation rule:\ You must provide **either** a block range, a time range, or explicit selectors.\ Providing more than one option (e.g., both ranges or ranges plus selectors) results in HTTP 400.\ Providing none results in HTTP 400. #### Direct Selectors Explicit set of block numbers. Mutually exclusive with `tx_hashes`. Explicit set of transaction hashes (hex string, 32 bytes, no `0x` prefix). Mutually exclusive with `block_numbers`. #### Address & Type Filters Filter by sender address (20 bytes, hex string, no `0x` prefix). Filter by recipient address (20 bytes, hex string, no `0x` prefix). Contract-creation transactions set `to_address` to `null` and are excluded when this filter is present. Filter by contract addresses created by the transaction. Filter by execution status (`true` = success, `false` = revert). Omit to include pre-Byzantium transactions with `null` status. Filter by transaction type ID (e.g., `2` = EIP-1559, `1` = legacy). #### Pagination Controls Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Opaque pagination cursor supplied by a previous response. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Filter parameters (block numbers, hashes, addresses, status flags) echoed from the request. #### Data Array of transaction objects. Block height containing the transaction. Block timestamp joined from the `blocks` table for easier aggregation. Keccak-256 hash of the transaction (32 bytes, hex string, no `0x` prefix). Zero-based index within the block; directly verifiable from RLP. Sender address (20 bytes). Recipient address (20 bytes). `null` denotes contract creation. Address of the contract created by this transaction. `null` for non-creation transactions. Gas consumed by the transaction (string to preserve `NUMERIC(78)` precision). Effective gas price paid, expressed in wei (string to preserve precision). Execution status: `true` = success, `false` = revert, `null` for pre-Byzantium blocks. Post-transaction state root for pre-Byzantium blocks (32 bytes). Transaction type identifier (e.g., `2` = EIP-1559, `1` = legacy). `true` if trace failed, `false` if trace succeeded, `null` if trace not available. Value transferred in wei (string to preserve `NUMERIC` precision). Calldata sent with the transaction (hex string, no `0x` prefix). Sender nonce. Gas limit provided by the sender (string to preserve `NUMERIC` precision). Legacy gas price in wei (string to preserve `NUMERIC` precision). Max fee per gas in wei for EIP-1559 transactions (string to preserve `NUMERIC` precision). Max priority fee per gas in wei for EIP-1559 transactions (string to preserve `NUMERIC` precision). Tracing identifier for the canonical transaction record (hex string, no `0x` prefix). Record last update timestamp. Record creation timestamp. #### Envelope Fields Cursor token for pagination. Number of records returned in `data`. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/raw/transactions" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z", "block_numbers": [ 12345678, 12345679 ], "tx_hashes": [ "7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0" ], "from_addresses": [ "0000000000000000000000000000000000000000" ], "to_addresses": [ "0000000000000000000000000000000000000001" ], "created_contract_addresses": [ "0000000000000000000000000000000000000002" ], "status_success": true, "tx_types": [ 0, 1, 2 ], "limit": 200, "cursor": null }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"from_block\":12345678,\"to_block\":12345999,\"from_timestamp\":\"2025-10-29T00:00:00Z\",\"to_timestamp\":\"2025-11-11T00:00:00Z\",\"block_numbers\":[12345678,12345679],\"tx_hashes\":[\"7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0\"],\"from_addresses\":[\"0000000000000000000000000000000000000000\"],\"to_addresses\":[\"0000000000000000000000000000000000000001\"],\"created_contract_addresses\":[\"0000000000000000000000000000000000000002\"],\"status_success\":true,\"tx_types\":[0,1,2],\"limit\":200,\"cursor\":null}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/raw/transactions"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"from_block\":12345678,\"to_block\":12345999,\"from_timestamp\":\"2025-10-29T00:00:00Z\",\"to_timestamp\":\"2025-11-11T00:00:00Z\",\"block_numbers\":[12345678,12345679],\"tx_hashes\":[\"7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0\"],\"from_addresses\":[\"0000000000000000000000000000000000000000\"],\"to_addresses\":[\"0000000000000000000000000000000000000001\"],\"created_contract_addresses\":[\"0000000000000000000000000000000000000002\"],\"status_success\":true,\"tx_types\":[0,1,2],\"limit\":200,\"cursor\":null}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/raw/transactions", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/raw/transactions", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={'block_numbers': [12345678, 12345679], 'chain_id': 1, 'created_contract_addresses': ['0000000000000000000000000000000000000002'], 'from_addresses': ['0000000000000000000000000000000000000000'], 'from_block': 12345678, 'from_timestamp': '2025-10-29T00:00:00Z', 'status_success': True, 'to_addresses': ['0000000000000000000000000000000000000001'], 'to_block': 12345999, 'to_timestamp': '2025-11-11T00:00:00Z', 'tx_hashes': ['7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0'], 'tx_types': [0, 1, 2], 'limit': 200, 'cursor': None} ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/raw/transactions", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z", "block_numbers": [ 12345678, 12345679 ], "tx_hashes": [ "7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0" ], "from_addresses": [ "0000000000000000000000000000000000000000" ], "to_addresses": [ "0000000000000000000000000000000000000001" ], "created_contract_addresses": [ "0000000000000000000000000000000000000002" ], "status_success": true, "tx_types": [ 0, 1, 2 ], "limit": 200, "cursor": null }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z", "block_numbers": [ 12345678, 12345679 ], "tx_hashes": [ "7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0" ], "from_addresses": [ "0000000000000000000000000000000000000000" ], "to_addresses": [ "0000000000000000000000000000000000000001" ], "created_contract_addresses": [ "0000000000000000000000000000000000000002" ], "status_success": true, "tx_types": [ 0, 1, 2 ], "limit": 200, "cursor": null }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/raw/transactions", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "request_window": { "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z" }, "resolved_window": { "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z" }, "filters": { "block_numbers": [ 12345678, 12345679 ], "tx_hashes": [ "7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0" ], "from_addresses": [ "0000000000000000000000000000000000000000" ], "to_addresses": [ "0000000000000000000000000000000000000001" ], "created_contract_addresses": [ "0000000000000000000000000000000000000002" ], "status_success": true, "tx_types": [ 0, 1, 2 ] } }, "data": [ { "block_number": 12345678, "block_time": "2025-11-11T18:42:15.123Z", "tx_hash": "7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0", "tx_index": 4, "from_address": "0000000000000000000000000000000000000000", "to_address": "0000000000000000000000000000000000000001", "created_contract_address": null, "gas_used": "21000", "effective_gas_price_wei": "1234567890123456789", "status_success": true, "root": null, "tx_type": 2, "trace_failed": false, "value_wei": "0", "input": "a9059cbb000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000003e8", "nonce": 7, "gas_limit": 21000, "gas_price_wei": "1234567890", "max_fee_per_gas_wei": "2000000000", "max_priority_fee_per_gas_wei": "1000000000", "_tracing_id": "010200000000000000000000000000000000", "_created_at": "2025-11-11T18:42:15.123Z", "_updated_at": "2025-11-11T18:42:15.123Z" } ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or exchanges" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, # configured rate limit "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Liquidity Distribution Source: https://docs.blockdb.io/api-reference/evm/reserves/liquidity-distribution POST https://api.blockdb.io/v1/evm/reserves/liquidity-distribution On-demand per-tick liquidity and token amounts for concentrated liquidity pools. ## Overview * **Dataset ID:** [`0301 - Liquidity Pool Reserves`](/data-catalog/evm/reserves/liquidity-pools-reserves) * **Description:** Retrieves the full tick-level liquidity distribution for a single concentrated-liquidity pool snapshot (Uniswap v3/v4-style). Amounts are computed on demand from the stored `liquidity_values` blob — no pre-aggregated detail table is queried. * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/Liquidity-Pools-Reserves-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0301_liquidity_pools_reserves_details_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/Liquidity-Pools-Reserves-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0301_liquidity_pools_reserves_details_v1.json?download=true) Returns the full tick-level liquidity distribution for a single concentrated-liquidity pool snapshot (Uniswap v3/v4-style). Amounts are computed on demand from the stored `liquidity_values` blob — no pre-aggregated detail table is queried. **Key characteristics:** * Returns one snapshot per call (the most recent within the requested block/time window) * Configurable price window: `1.0`-`10.0`% symmetric band around the current price * Each tick row carries both raw (`amount0_raw`) and decimals-adjusted (`amount0`) amounts For **even-distribution** pools (Uniswap v2, Balancer, etc.) use [`POST /v1/evm/reserves`](/api-reference/evm/reserves/reserves). ## Parameters Target EVM network. *See the [Chain](/api-reference/enumerations/chain) enumeration.* #### Pool Selector (exactly one required) BlockDB 32-byte pool identifier (hex, no `0x`). Pool contract address (hex, 20 bytes, no `0x`). Protocol-specific pool ID, e.g. Uniswap V4 `pool_id` (hex, 32 bytes, no `0x`). Provide **exactly one** of `pool_uid`, `pool_address`, or `pool_id`. Providing more or fewer results in HTTP 400. #### Snapshot Selector (exactly one required) Direct snapshot key (hex, no `0x`). When set, block/time range must not be provided. Starting block number (inclusive). Use with `to_block`. The most recent snapshot within the range is returned. Ending block number (inclusive). Use with `from_block`. Starting timestamp (ISO-8601). Use with `to_timestamp`. Ending timestamp (ISO-8601). Use with `from_timestamp`. #### Price Window Symmetric percent band around the current price tick, e.g. `5.0` = ±5%. Must be between `1.0` and `10.0` inclusive. Values outside this range return HTTP 400. #### Amounts Off by default. When set to `true`, each tick row includes `amount0` and `amount1` scaled by ERC-20 decimals. Enabling it adds a per-request ERC-20 decimals lookup (extra join) that increases latency, so it is opt-in; when omitted or `false`, `amount0`/`amount1` are `null` and only the always-present `amount0_raw`/`amount1_raw` fields are populated. ## Response Fields #### Envelope EVM chain ID echoed from the request. Block/timestamp bounds echoed from the request. Filters echoed from the request. The single resolved snapshot. #### Snapshot Fields BlockDB pool identifier. Exchange identifier. Pool type identifier. Block height of the snapshot. Block timestamp (ISO-8601). Transaction index within the block. Log index within the transaction. Pool tick spacing (e.g. `60` for a 0.3% Uniswap v3 pool). Active tick at the time of the snapshot. Q64.96 sqrt price as an integer string. Echoed from the request. Actual lower bound of the tick range returned (aligned to tick spacing). Actual upper bound of the tick range returned. Token0 contract address (hex, no `0x`). Populated when pool metadata is available. Token1 contract address (hex, no `0x`). Populated when pool metadata is available. ERC-20 decimals for token0. `null` when unavailable or `include_adjusted_amounts` is `false`. ERC-20 decimals for token1. `null` when unavailable or `include_adjusted_amounts` is `false`. Ordered array of tick rows within the resolved range. Only ticks with non-zero liquidity are included. Lineage hash for the snapshot row. #### Tick Row Fields (`snapshot.ticks[]`) Lower tick of this liquidity position (same as `lower_tick`). Lower bound of the tick interval. Upper bound of the tick interval (`lower_tick + tick_spacing`). Uniswap v3 liquidity value (L) for this tick as an integer string. Token0 amount at this tick in base units (integer string, no decimals applied). Token0 amount divided by `10^token0_decimals`. `null` when decimals are unavailable or `include_adjusted_amounts` is `false`. Token1 amount at this tick in base units (integer string, no decimals applied). Token1 amount divided by `10^token1_decimals`. `null` when decimals are unavailable or `include_adjusted_amounts` is `false`. ```bash cURL — ±5% window theme={null} curl -X POST "https://api.blockdb.io/v1/evm/reserves/liquidity-distribution" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "pool_uid": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000", "from_block": 20000000, "to_block": 20001000, "price_window_percent": 5.0, "include_adjusted_amounts": true }' ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/reserves/liquidity-distribution", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={ "chain_id": 1, "pool_uid": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000", "from_block": 20000000, "to_block": 20001000, "price_window_percent": 5.0, "include_adjusted_amounts": True } ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/reserves/liquidity-distribution", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "pool_uid": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000", "from_block": 20000000, "to_block": 20001000, "price_window_percent": 5.0, "include_adjusted_amounts": true }) }); const data = await response.json(); console.log(data); ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"pool_uid\":\"88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000\",\"from_block\":20000000,\"to_block\":20001000,\"price_window_percent\":5.0,\"include_adjusted_amounts\":true}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync( "https://api.blockdb.io/v1/evm/reserves/liquidity-distribution", payload); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); } } ``` ```json 200 theme={null} { "chain_id": 1, "request_window": { "from_block": 20000000, "to_block": 20001000, "from_timestamp": null, "to_timestamp": null }, "filters": { "pool_uid": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000", "pool_address": null, "pool_id": null, "tracing_id": null, "price_window_percent": 5.0, "include_adjusted_amounts": true }, "snapshot": { "pool_uid": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000", "exchange_id": 1, "type_id": 301, "block_number": 20000842, "block_time": "2025-11-11T18:42:15.123Z", "tx_index": 12, "log_index": 3, "tick_spacing": 60, "current_tick": 210130, "current_sqrt_price": "14614467034852101032872730522039888223787", "price_window_percent": 5.0, "resolved_lower_tick": 209580, "resolved_upper_tick": 210660, "token0_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "token1_address": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "token0_decimals": 18, "token1_decimals": 6, "ticks": [ { "tick": 210060, "lower_tick": 210060, "upper_tick": 210120, "liquidity": "5823941670000000000000000000", "amount0_raw": "1000000000000000000", "amount0": "1.0", "amount1_raw": "2500000000", "amount1": "2500.0" }, { "tick": 210120, "lower_tick": 210120, "upper_tick": 210180, "liquidity": "9104823200000000000000000000", "amount0_raw": "840000000000000000", "amount0": "0.84", "amount1_raw": "1890000000", "amount1": "1890.0" }, "..." ], "_tracing_id": "0301000000000000000000000000000000000002" } } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "price_window_percent must be between 1 and 10.", "hint": "Use a value in [1.0, 10.0], e.g. 5.0 for ±5%.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/evm/reserves/liquidity-distribution" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "No concentrated-liquidity reserves snapshot was found for the given parameters.", "hint": "Verify the pool selector and block/time range. This endpoint only returns snapshots that contain liquidity_values data.", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/evm/reserves/liquidity-distribution" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "severity": "critical", "retryable": true, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Pools Reserves Overview Source: https://docs.blockdb.io/api-reference/evm/reserves/overview Access normalized pool reserve snapshots for on-chain liquidity analytics and time-series analysis. ## Overview The Pools Reserves endpoints provide time-series snapshots of AMM pool liquidity states. Reserve data is normalized across pool types (constant-product, concentrated liquidity, weighted, bin-based) to enable consistent analytics regardless of the underlying AMM. Each snapshot includes lineage metadata linking back to on-chain state changes. ### Endpoint Matrix | Endpoint | Summary | Dataset ID | Typical Latency | | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | ---------- | --------------- | | [`POST /v1/evm/reserves`](/api-reference/evm/reserves/reserves) | Normalized reserve snapshots with decimals-adjusted amounts | `0301` | \< 250 ms | | [`POST /v1/evm/reserves/liquidity-distribution`](/api-reference/evm/reserves/liquidity-distribution) | Per-tick liquidity distribution for concentrated liquidity pools | `0301` | \< 400 ms | ### Parameter Conventions Starting block height (inclusive) for reserve snapshots. Ending block height (inclusive) for reserve snapshots. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. BlockDB pool identifiers for direct lookups. Pool contract addresses to scope reserve data. Provider-specific pool identifiers when applicable. Exchange identifiers for filtering by DEX protocol. AMM model filters. Use [Pool Type enumeration](/api-reference/enumerations/pool-type) values. Chain identifier for the target EVM network. See [Chain enumeration](/api-reference/enumerations/chain) for supported values. Off by default. When set to `true`, reserve amounts and tick amounts are also returned scaled by ERC-20 token decimals. Enabling it adds a per-request ERC-20 decimals lookup (extra join) that increases latency, so it is opt-in; when omitted or `false`, only the always-present raw base-unit fields are populated. ### Usage Guidance * **Join with pools metadata** — Link reserve snapshots to pool metadata via `pool_uid` for complete context * **Time-series analysis** — Reserve data is optimized for chronological queries; use block/time ranges for historical analysis * **Filter by exchange** — Use `exchange_ids` to focus on specific DEX protocols (Uniswap, Curve, etc.) * **Concentrated liquidity** — Use [`/v1/evm/reserves/liquidity-distribution`](/api-reference/evm/reserves/liquidity-distribution) for per-tick breakdown with a configurable price window (1–10%) * **Decimals-adjusted amounts** — Enable `include_adjusted_amounts` (off by default) to receive human-readable token amounts alongside raw base-unit values; it adds a decimals lookup, so opt in only when you need the scaled values * **Cache recent snapshots** — Latest reserve states change frequently; cache with short TTL (1–5 minutes) ### Reserve Data Models **Even-Distribution Pools** (Uniswap v2, SushiSwap, Balancer): * `reserves`: Array of raw token balances (base units) * `reserves_decimals_adjusted`: Same values divided by each token's decimals (e.g. `/ 10^18` for ETH) * `current_tick`: `null` * `current_sqrt_price`: `null` **Concentrated Liquidity** (Uniswap v3/v4, SushiSwap v3, PancakeSwap v3): * `reserves`: `null` (reserves are distributed across ticks) * `current_tick`: Active tick position * `current_sqrt_price`: Q64.96 sqrt price * For per-tick distribution → use [`/v1/evm/reserves/liquidity-distribution`](/api-reference/evm/reserves/liquidity-distribution) **Bin-Based Pools** (TraderJoe v2, Aerodrome Slipstream): * `current_bin`: Active bin identifier ### Common Patterns **Track pool reserves over time:** ```json theme={null} { "chain_id": 1, "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "from_timestamp": "2025-01-01T00:00:00Z", "to_timestamp": "2025-01-31T23:59:59Z", "include_adjusted_amounts": true } ``` **Get reserves for all Uniswap v2 pools (raw amounts only):** ```json theme={null} { "chain_id": 1, "pool_type_ids": [201], "from_block": 18000000, "to_block": 18001000, "include_adjusted_amounts": false } ``` **Analyze concentrated liquidity tick distribution (±5% around spot):** ```json theme={null} { "chain_id": 1, "pool_uid": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000", "from_block": 20000000, "to_block": 20001000, "price_window_percent": 5.0, "include_adjusted_amounts": true } ``` ### Dataset Relationships * **Pools → Reserves**: Join pool metadata to reserve snapshots using `pool_uid` * **Reserves → Swap Fees**: Combine swap-fee time-series with reserve state for pool economics * **Swap Fees → Yields**: Yield predictions are derived from swap fees and current reserves * **Reserves → Prices**: Reserve changes drive pricing calculations in L1/L2/L3 layers * **Reserves → Transactions**: Reserve snapshots link to transaction logs via `_parent_tracing_ids` ### See Also * [`POST /v1/evm/reserves`](/api-reference/evm/reserves/reserves) — Reserve snapshots with decimals-adjusted amounts * [`POST /v1/evm/reserves/liquidity-distribution`](/api-reference/evm/reserves/liquidity-distribution) — Per-tick liquidity distribution * [`POST /evm/swaps/fees`](/api-reference/evm/swaps/swap-fees) — Per-swap fee accounting * [`POST /evm/yields`](/api-reference/evm/yields/yields) — Yield/ROI predictions * [`POST /evm/entities/pools`](/api-reference/evm/entities/pools) — Pool metadata registry * [Pool Type](/api-reference/enumerations/pool-type) — AMM pool classifications * [Digital Exchange](/api-reference/enumerations/digital-exchange) — DEX protocol identifiers * [Pricing Suite Overview](/api-reference/evm/prices/crypto/overview) — Price data derived from reserves # Reserves Source: https://docs.blockdb.io/api-reference/evm/reserves/reserves POST https://api.blockdb.io/v1/evm/reserves Read normalized pool reserve snapshots for on-chain liquidity analytics. ## Overview * **Dataset ID:** [`0301 - Liquidity Pool Reserves`](/data-catalog/evm/reserves/liquidity-pools-reserves) * **Description:** Retrieves time-series snapshots of AMM pool reserves, covering both even-distribution (constant-product, weighted, stable) and concentrated/bin liquidity models. * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/Liquidity-Pools-Reserves-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0301_liquidity_pools_reserves_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/Liquidity-Pools-Reserves-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0301_liquidity_pools_reserves_v1.json?download=true) For **concentrated liquidity** (Uniswap v3/v4-style) tick distribution, use the dedicated [`POST /v1/evm/reserves/liquidity-distribution`](/api-reference/evm/reserves/liquidity-distribution) endpoint, which computes per-tick amounts on demand with a configurable price window. ## Parameters Target EVM network. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.* #### Range Filters (mutually exclusive) Starting block number (inclusive) for the query. Use with `to_block`. Ending block number (inclusive) for the query. Use with `from_block`. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Use with `to_timestamp`. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. Use with `from_timestamp`. Validation rule:\ You must provide **either** a block range, a time range, or at least one direct selector.\ Providing more than one option results in HTTP 400.\ Providing none results in HTTP 400. #### Pool Selectors Filter snapshots by exchange IDs. *See the [DigitalExchange](/api-reference/enumerations/digital-exchange) enumeration for supported values.* Filter by BlockDB pool identifiers (`uid` from `/evm/entities/pools`). Filter by pool contract addresses (hex string, 20 bytes, no `0x` prefix). Filter by protocol-specific pool identifiers (e.g., Uniswap V4 `pool_id`). Filter snapshots by pool archetype. *See the [PoolType](/api-reference/enumerations/pool-type) enumeration for supported values.* #### Amounts Off by default. When set to `true`, each snapshot includes `reserves_decimals_adjusted` — the same reserve amounts scaled by ERC-20 token decimals (e.g. dividing a USDC value by 10⁶). Enabling it adds a per-request ERC-20 decimals lookup (extra join) that increases latency, so it is opt-in; when omitted or `false`, `reserves_decimals_adjusted` is `null` and only the always-present raw `reserves` array is populated. #### Pagination Controls Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Pagination cursor from a prior call. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Filters echoed from the request (e.g., exchange IDs, pool identifiers, pool types). #### Data Array of reserve snapshot objects. BlockDB pool identifier (`uid` from `/evm/entities/pools`). Exchange identifier associated with the pool. Pool type identifier. Block height where the reserve change was observed. Block timestamp when the event occurred. Zero-based index of the parent transaction within the block. Position of the log within the transaction. Current reserves per token in pool order, as raw integer strings (base units). `null` for concentrated-liquidity pools where reserves are not stored at the snapshot level. Same order as `reserves`, but each value divided by `10^decimals` for the corresponding ERC-20 token. `null` when decimals are unavailable for at least one pool token, when `reserves` is `null`, or when `include_adjusted_amounts` is `false`. Current tick for concentrated-liquidity pools. `null` when not applicable. Q64.96 sqrt price as an integer string. `null` when not applicable. Current bin id for bin-style AMMs. `null` when not applicable. Row-level lineage hash for the snapshot. Lineage references of immediate parents. Record creation timestamp. Record last update timestamp. #### Envelope Fields Cursor token for pagination. Number of records returned in `data`. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/reserves" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "pool_type_ids": [201, 302], "include_adjusted_amounts": true }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"from_block\":12345678,\"to_block\":12345999,\"pool_uids\":[\"88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000\"],\"pool_type_ids\":[201,302],\"include_adjusted_amounts\":true}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/reserves"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"from_block\":12345678,\"to_block\":12345999,\"pool_uids\":[\"88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000\"],\"pool_type_ids\":[201,302],\"include_adjusted_amounts\":true}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/reserves", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/reserves", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "pool_uids": ["88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000"], "pool_type_ids": [201, 302], "include_adjusted_amounts": True } ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/reserves", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "pool_type_ids": [201, 302], "include_adjusted_amounts": true }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "pool_type_ids": [201, 302], "include_adjusted_amounts": true }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/reserves", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "request_window": { "from_block": 12345678, "to_block": 12345999, "from_timestamp": null, "to_timestamp": null }, "resolved_window": { "from_block": 12345678, "to_block": 12345999, "from_timestamp": null, "to_timestamp": null }, "filters": { "exchange_ids": null, "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "pool_addresses": null, "pool_ids": null, "pool_type_ids": [201, 302] } }, "data": [ { "pool_uid": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000", "exchange_id": 1, "type_id": 201, "block_number": 18934567, "block_time": "2025-11-11T18:42:15.123Z", "tx_index": 4, "log_index": 2, "reserves": [ "169649594140000000000000", "60446403492000" ], "reserves_decimals_adjusted": [ "169649.59414", "60446403.492" ], "current_tick": null, "current_sqrt_price": null, "current_bin": null, "_tracing_id": "0301000000000000000000000000000000000000", "_parent_tracing_ids": [ "0203000000000000000000000000000000000000" ], "_created_at": "2025-11-11T18:42:15.123Z", "_updated_at": "2025-11-11T18:42:15.123Z" }, ... ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io" }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "retry_after_seconds": 2, "limit_scope": "api_key" }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # JSON-RPC Example Source: https://docs.blockdb.io/api-reference/evm/rpc/example POST https://api.blockdb.io/v1/evm/rpc?chain_id=1 Detailed example of executing a standard Ethereum JSON-RPC method through BlockDB. ## Overview BlockDB supports standard Ethereum JSON-RPC methods. This page provides a template for making calls to the JSON-RPC endpoint, including the expected request structure and response format. ## Request Parameters Standard JSON-RPC 2.0 requests require the following fields in the JSON body: The version of the JSON-RPC protocol. Must be `"2.0"`. The name of the Ethereum method to be invoked (e.g., `eth_getBlockByNumber`, `eth_call`, `eth_getBalance`). A structured array of parameters for the specific method being called. A unique identifier established by the client that will be echoed back in the response. ## Response Fields The JSON-RPC response follows the standard envelope: The version of the JSON-RPC protocol. The unique identifier passed in the request. The method-specific result object. The structure varies depending on the method invoked. Present only if the request failed. Contains `code`, `message`, and optional `data`. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/rpc?chain_id=1" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "eth_getBlockByNumber", "params": ["latest", false] }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"eth_getBlockByNumber\",\"params\":[\"latest\",false]}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/rpc?chain_id=1"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"eth_getBlockByNumber\",\"params\":[\"latest\",false]}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/rpc?chain_id=1", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/rpc?chain_id=1", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={ "jsonrpc": "2.0", "id": 1, "method": "eth_getBlockByNumber", "params": ["latest", False] } ) print(response.json()) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/rpc?chain_id=1", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "jsonrpc": "2.0", "id": 1, "method": "eth_getBlockByNumber", "params": ["latest", false] }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "jsonrpc": "2.0", "id": 1, "method": "eth_getBlockByNumber", "params": ["latest", false] }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/rpc?chain_id=1", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() } ``` ```json 200 theme={null} { "jsonrpc": "2.0", "id": 1, "result": { "number": "0x1213456", "hash": "0x7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0", "parentHash": "0xf78e26c5959a94d6a62ed3837f5dcecf0d3761bf0a502e12a08fd7bc44c8568d", "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", "miner": "0x0000000000000000000000000000000000000000", "stateRoot": "0x...", "transactionsRoot": "0x...", "receiptsRoot": "0x...", "logsBloom": "0x...", "difficulty": "0x0", "totalDifficulty": "0x...", "size": "0x...", "extraData": "0x...", "gasLimit": "0x1c9c380", "gasUsed": "0x...", "timestamp": "0x654f1234", "transactions": [], "uncles": [] } } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or exchanges" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, # configured rate limit "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # JSON-RPC Overview Source: https://docs.blockdb.io/api-reference/evm/rpc/overview POST https://api.blockdb.io/v1/evm/rpc?chain_id= Use BlockDB as an EVM JSON-RPC endpoint compatible with standard Ethereum execution-client methods. ## Overview BlockDB exposes a **drop-in compatible Ethereum JSON-RPC** endpoint for EVM networks. Use it when you want to connect existing tooling (web3 libraries, indexers, bots) without rewriting to BlockDB's REST endpoint format. This page documents the BlockDB entrypoint and the key conventions you need to call Ethereum JSON-RPC successfully. ## Endpoint ```text theme={null} POST https://api.blockdb.io/v1/evm/rpc?chain_id= ``` ### Authentication Send your API key on every request: ```text theme={null} Authorization: Bearer ``` ## Pricing JSON-RPC access is included in all BlockDB plans. * **Basic Plan**: Shared infrastructure, standard rate limits. * **Standard & Platinum Plans**: High-throughput access with dedicated support options. For more details, see [Pricing](/pricing/home). ## Method Compatibility We support the **classic Ethereum execution-client JSON-RPC method families**, including: * `eth_*` * `net_*` For the canonical method list and parameter conventions, see the Ethereum JSON-RPC reference: * [Ethereum JSON-RPC API (execution client)](https://ethereum.org/developers/docs/apis/json-rpc/) ## Conventions (important) ### Hex encoding Ethereum JSON-RPC uses hex encoding with specific rules: * **Quantities** (block numbers, integers): hex with `0x` prefix, most compact form (`0x0` for zero) * **Byte arrays** (hashes, addresses, calldata): hex with `0x` prefix, two hex digits per byte ### Block parameter Many methods accept a “block parameter”. Common values include: * `"earliest"`, `"latest"`, `"safe"`, `"finalized"`, `"pending"` * A specific block number encoded as a hex quantity (e.g., `"0x12A05F"`). ## Examples ### Example: `eth_getBlockByNumber` ```bash theme={null} curl -X POST "https://api.blockdb.io/v1/evm/rpc?chain_id=1" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "eth_getBlockByNumber", "params": ["latest", false] }' ``` ### Example: `eth_call` ```bash theme={null} curl -X POST "https://api.blockdb.io/v1/evm/rpc?chain_id=1" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "id": 2, "method": "eth_call", "params": [ { "to": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "data": "0x313ce567" }, "latest" ] }' ``` ## See also * [EVM Primitives Overview](/api-reference/evm/primitives/overview) * [Authorization](/api-reference/overview/authorization) * [Pricing Overview](/pricing/home) # Swaps Overview Source: https://docs.blockdb.io/api-reference/evm/swaps/overview Access per-swap fee accounting for pool economics, revenue attribution, and yield modeling. ## Overview The Swaps endpoint provides per-swap fee accounting for AMM pools. Each swap record includes executed token amounts, computed fee amounts, and fee splits across recipients (LPs/users, protocol, extra destinations). This data enables revenue attribution, pool economics analysis, and feeds into yield prediction models. ### Endpoint Matrix | Endpoint | Summary | Dataset ID | Typical Latency | | ------------------------------------------------------------ | ------------------------------------------------------ | ---------- | --------------- | | [`POST /evm/swaps/fees`](/api-reference/evm/swaps/swap-fees) | Per-swap fee accounting (executed sizes + fee amounts) | `0303` | \< 250 ms | ### Parameter Conventions Starting block height (inclusive) for swap fee records. Ending block height (inclusive) for swap fee records. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. BlockDB pool identifiers for filtering swap fees by pool. Pool contract addresses to scope swap fee data. Filter by input token addresses. Filter by output token addresses. Filter by fee token addresses. Chain identifier for the target EVM network. See [Chain enumeration](/api-reference/enumerations/chain) for supported values. ### Usage Guidance * **Join with fee terms** — Link swap fees to pool fee configuration via `pool_uid` to understand fee splits * **Time-series analysis** — Swap fees are ordered by block/time; use ranges for historical revenue analysis * **Filter by tokens** — Use `token_in_addresses` and `token_out_addresses` to analyze specific trading pairs * **Revenue attribution** — Fee split fields (`fee_amount_user`, `fee_amount_protocol`, `fee_amount_extra`) enable precise revenue attribution * **Feed yield models** — Swap fee data is the primary input for yield/ROI predictions (see `/evm/yields`) ### Fee Calculation Swap fees are computed using the pool's fee terms (from `/evm/entities/pools/fee-terms`): * `fee_amount_total ≈ amount_in * total_fee` * `fee_amount_user ≈ amount_in * user_fee` (when available) * `fee_amount_protocol ≈ amount_in * protocol_fee` (when available) * `fee_amount_extra ≈ amount_in * extra_fee` (when available) Fee amounts are denominated in the `fee_token`, which may differ from `token_in` or `token_out` depending on the pool type. ### Common Patterns **Calculate pool revenue over time:** ```json theme={null} { "chain_id": 1, "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "from_timestamp": "2025-01-01T00:00:00Z", "to_timestamp": "2025-01-31T23:59:59Z" } ``` **Analyze fees for a specific trading pair:** ```json theme={null} { "chain_id": 1, "token_in_addresses": [ "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" ], "token_out_addresses": [ "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" ], "from_block": 19000000 } ``` **Track protocol revenue:** ```json theme={null} { "chain_id": 1, "pool_addresses": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f564" ], "from_timestamp": "2025-12-01T00:00:00Z", "to_timestamp": "2025-12-31T23:59:59Z" } ``` ### Dataset Relationships * **Pools → Swap Fees**: Join pool metadata to swap fees using `pool_uid` * **Fee Terms → Swap Fees**: Fee terms define the fee calculation rules applied to each swap * **Swap Fees → Yields**: Yield predictions are derived from historical swap fees and current reserves * **Swap Fees → Reserves**: Swap fees indicate liquidity changes that affect reserve snapshots * **Swap Fees → Prices**: Swap execution prices are captured in the pricing layers ### See Also * [`POST /evm/swaps/fees`](/api-reference/evm/swaps/swap-fees) — Per-swap fee accounting endpoint * [`POST /evm/entities/pools/fee-terms`](/api-reference/evm/entities/fee-terms) — Pool fee configuration * [`POST /evm/yields`](/api-reference/evm/yields/yields) — Yield/ROI predictions derived from swap fees * [`POST /evm/reserves`](/api-reference/evm/reserves/reserves) — Pool reserve snapshots * [`POST /evm/entities/pools`](/api-reference/evm/entities/pools) — Pool metadata registry * [Pool Type](/api-reference/enumerations/pool-type) — AMM pool classifications # Swap Fees Source: https://docs.blockdb.io/api-reference/evm/swaps/swap-fees POST https://api.blockdb.io/v1/evm/swaps/fees Read per-swap fee accounting (executed sizes + computed fee amounts) for pool economics and yield modeling. ## Overview * **Dataset ID:** [`0303 - Liquidity Pool Swap Fees`](/data-catalog/evm/swaps/liquidity-pools-swap-fees) * **Description:** Per-swap fee accounting: executed swap sizes plus computed fee amounts using the pool's fee terms (`blockdb_evm.b0212_liquidity_pools_fee_terms_v1`). * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/Swap-Fees-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0303_liquidity_pools_swap_fees_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/Swap-Fees-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0303_liquidity_pools_swap_fees_v1.json?download=true) ## Parameters Target EVM network. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.* #### Range Filters (mutually exclusive) Starting block number (inclusive) for the query. Use with `to_block`. Ending block number (inclusive) for the query. Use with `from_block`. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Use with `to_timestamp`. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. Use with `from_timestamp`. Validation rule:\ You must provide **either** a block range, a time range, or at least one direct selector.\ Providing more than one option results in HTTP 400.\ Providing none results in HTTP 400. #### Pool Selectors Filter swaps by exchange IDs. *See the [DigitalExchange](/api-reference/enumerations/digital-exchange) enumeration for supported values.* Filter by BlockDB pool identifiers (`uid` from `/evm/entities/pools`). Filter by pool contract addresses (hex string, 20 bytes, no `0x` prefix). Filter by protocol-specific pool identifiers (e.g., Uniswap V4 `pool_id`). Filter by AMM archetype. *See the [PoolType](/api-reference/enumerations/pool-type) enumeration for supported values.* #### Token Selectors (directional) Restrict to swaps where the input token is in this set (hex string, 20 bytes, no `0x` prefix). Restrict to swaps where the output token is in this set (hex string, 20 bytes, no `0x` prefix). Restrict to swaps where the fee is denominated in one of these tokens (hex string, 20 bytes, no `0x` prefix). #### Pagination Controls Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Pagination cursor from a prior call. #### Decimals-Adjusted Amounts Off by default. When set to `true`, the response includes decimals-adjusted siblings of every `*_raw` field (`amount_in`, `amount_out`, `fee_amount_total`, `fee_amount_user`, `fee_amount_protocol`, `fee_amount_extra`). Enabling it adds a per-request ERC-20 decimals lookup (extra join) that increases latency, so it is opt-in; when omitted or `false`, those fields are returned as `null` and only the always-present `*_raw` fields are populated. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Filters echoed from the request (selectors, pagination state, etc.). #### Data Array of per-swap fee records matching the request. There is no separate numeric `id` field. BlockDB pool identifier (`uid` from `/evm/entities/pools`). Exchange/DEX identifier. Pool type identifier. 20-byte address of the input token (direction of trade). 20-byte address of the output token for this swap direction. Token address the fee is denominated in (typically `token_in`). Executed input amount as a raw integer in `token_in`'s smallest denomination. String-encoded to preserve `uint256` precision. Decimals-adjusted form of `amount_in_raw` (`amount_in_raw / 10^decimals` resolved against `token_in`). `null` when decimals are unknown or `include_adjusted_amounts=false`. Executed output amount as a raw integer in `token_out`'s smallest denomination. Decimals-adjusted form of `amount_out_raw` (resolved against `token_out`). `null` when decimals are unknown or `include_adjusted_amounts=false`. Total fee amount as a raw integer in `fee_token`'s smallest denomination. Decimals-adjusted form of `fee_amount_total_raw` (resolved against `fee_token`). `null` when decimals are unknown or `include_adjusted_amounts=false`. User/LP share of the fee as a raw integer in `fee_token` units. `null` when the protocol does not split. Decimals-adjusted form of `fee_amount_user_raw`. `null` when the raw value is `null`, when decimals are unknown, or when `include_adjusted_amounts=false`. Protocol share of the fee as a raw integer in `fee_token` units. `null` when the protocol does not split. Decimals-adjusted form of `fee_amount_protocol_raw`. Same null semantics as the user field. Extra-destination share of the fee as a raw integer in `fee_token` units. `null` when not applicable. Decimals-adjusted form of `fee_amount_extra_raw`. Same null semantics as the user field. Block height where the swap event was observed. UTC timestamp of the block containing the swap. Zero-based transaction index within the block. Zero-based log index within the transaction. Row-level lineage hash (hex string, no `0x` prefix). Lineage references of immediate parents. Record creation timestamp (ISO-8601). Last update timestamp (ISO-8601). #### Envelope Fields Cursor token for pagination. Number of records returned in `data`. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/swaps/fees" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "from_block": 19000000, "to_block": 19000100, "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "token_in_addresses": [ "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" ], "token_out_addresses": [ "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" ], "limit": 250 }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"from_block\":19000000,\"to_block\":19000100,\"pool_uids\":[\"88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000\"],\"token_in_addresses\":[\"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\"],\"token_out_addresses\":[\"a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\"],\"limit\":250}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/swaps/fees"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"from_block\":19000000,\"to_block\":19000100,\"pool_uids\":[\"88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000\"],\"token_in_addresses\":[\"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\"],\"token_out_addresses\":[\"a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\"],\"limit\":250}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/swaps/fees", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/swaps/fees", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={'chain_id': 1, 'from_block': 19000000, 'to_block': 19000100, 'pool_uids': ['88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000'], 'token_in_addresses': ['c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'], 'token_out_addresses': ['a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'], 'limit': 250} ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/swaps/fees", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "from_block": 19000000, "to_block": 19000100, "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "token_in_addresses": [ "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" ], "token_out_addresses": [ "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" ], "limit": 250 }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "from_block": 19000000, "to_block": 19000100, "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "token_in_addresses": [ "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" ], "token_out_addresses": [ "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" ], "limit": 250 }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/swaps/fees", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "request_window": { "from_block": 19000000, "to_block": 19000100 }, "resolved_window": { "from_block": 19000000, "to_block": 19000100 }, "filters": { "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "token_in_addresses": [ "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" ], "token_out_addresses": [ "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" ], "limit": 250, "cursor": null } }, "data": [ { "pool_uid": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000", "exchange_id": 1, "type_id": 201, "block_number": 19000042, "block_time": "2025-12-20T12:34:56Z", "tx_index": 15, "log_index": 88, "token_in": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "token_out": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "fee_token": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "amount_in_raw": "5000000000000000000", "amount_in": "5", "amount_out_raw": "15850000000", "amount_out": "15850", "fee_amount_total_raw": "15000000000000000", "fee_amount_total": "0.015", "fee_amount_user_raw": "12000000000000000", "fee_amount_user": "0.012", "fee_amount_protocol_raw": "3000000000000000", "fee_amount_protocol": "0.003", "fee_amount_extra_raw": "0", "fee_amount_extra": "0", "_tracing_id": "0303c0ffee000000000000000000000000000000000000000000000000000001", "_parent_tracing_ids": [ "0103c0ffee000000000000000000000000000000000000000000000000000001", "0204c0ffee000000000000000000000000000000000000000000000000000001" ], "_created_at": "2025-12-20T12:35:01Z", "_updated_at": "2025-12-20T12:35:01Z" } ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or exchanges" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, # configured rate limit "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Transfers Overview Source: https://docs.blockdb.io/api-reference/evm/transfers/overview Query all token transfer events — native ETH, ERC-20, ERC-721, and ERC-1155 — in a single unified endpoint. ## Overview The Transfers suite provides access to all token transfer events produced by the TokenTransfersEngine via a single unified endpoint. Use the optional `transfer_type` filter to narrow results to a specific asset kind. The endpoint supports the same request shape (chain, block or time range, optional address filters, pagination) and returns a consistent record format with lineage fields. ### Endpoint | Endpoint | Summary | Transfer types | | ------------------------------------------------------------------------------------- | ------------------------------------------------------------- | ---------------------------------------------------- | | [`POST /evm/transfers/token-transfers`](/api-reference/evm/transfers/token-transfers) | All transfer types in one response; filter by `transfer_type` | native\_tx, native\_internal, erc20, erc721, erc1155 | ### Parameter Conventions Target EVM network. See [Chain](/api-reference/enumerations/chain) for supported values. Starting block number (inclusive). Use with `to_block`. Ending block number (inclusive). Use with `from_block`. Starting timestamp (ISO-8601). Use with `to_timestamp`; mutually exclusive with block range. Ending timestamp (ISO-8601). Use with `from_timestamp`. Filter by sender address (hex, 20 bytes, no `0x` prefix). Filter by recipient address (hex, 20 bytes, no `0x` prefix). Filter by token contract (hex, 20 bytes). For native endpoint, omit or leave unset. Page size; max 1000. Stays under \~10 MB when combined with narrow ranges. Pagination cursor from a previous response. ### Usage Guidance * **Filter by type** — Pass `transfer_type` as integer codes (`0`=native\_tx, `1`=native\_internal, `2`=erc20, `3`=erc721, `4`=erc1155) to narrow results to a specific asset kind in a single request. *See the [TransferType](/api-reference/enumerations/transfer-type) enumeration.* * **Narrow by address** — Use `from_address` / `to_address` and optionally `token_address` to reduce payload and cost. * **Join with entities** — Use `token_address` with [ERC-20](/api-reference/evm/entities/tokens-erc20), [ERC-721](/api-reference/evm/entities/tokens-erc721), or [ERC-1155](/api-reference/evm/entities/tokens-erc1155) token metadata for symbols and decimals. ### Common Patterns **ERC-20 transfers for a wallet:** ```json theme={null} { "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "to_address": "0000000000000000000000000000000000000001", "limit": 250 } ``` **NFT (ERC-721) transfers for a collection:** ```json theme={null} { "chain_id": 1, "from_timestamp": "2025-01-01T00:00:00Z", "to_timestamp": "2025-01-31T23:59:59Z", "token_address": "bc4ca0eda7647a8ab7c2061c2e118a18a936f13d", "limit": 250 } ``` **Native ETH only (no token contract):** ```json theme={null} { "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "from_address": "0000000000000000000000000000000000000000", "limit": 250 } ``` **All transfer types in one request:** ```json theme={null} { "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "limit": 250 } ``` ### Dataset & Relationships * **Dataset ID:** `0304` — [Token transfers](/data-catalog/evm/transfers/token-transfers) (data catalog) * **Transfers → Transactions:** Join on `(block_number, tx_index)` to [transactions](/api-reference/evm/primitives/transactions) * **Transfers → Tokens:** Join `token_address` to [ERC-20](/api-reference/evm/entities/tokens-erc20), [ERC-721](/api-reference/evm/entities/tokens-erc721), or [ERC-1155](/api-reference/evm/entities/tokens-erc1155) for metadata ### See Also * [Token Transfers](/api-reference/evm/transfers/token-transfers) — Full endpoint reference * [Data catalog: Token Transfers](/data-catalog/evm/transfers/token-transfers) — Schema and columns # Token Transfers Source: https://docs.blockdb.io/api-reference/evm/transfers/token-transfers POST https://api.blockdb.io/v1/evm/transfers/token-transfers Query token transfer events (native ETH, ERC-20, ERC-721, ERC-1155) from transactions, internal transactions, and transfer logs. ## Overview * **Dataset ID:** [`0304 - Token Transfers`](/data-catalog/evm/transfers/token-transfers) * **Description:** Token transfer events (native ETH, ERC-20, ERC-721, ERC-1155) produced by TokenTransfersEngine from transactions, internal transactions, and transfer logs. * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/Token-Transfers-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0304_token_transfers_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/Token-Transfers-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0304_token_transfers_v1.json?download=true) ## Parameters Target EVM network. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.* #### Range Filters (mutually exclusive) Starting block number (inclusive) for the query. Use with `to_block`. Ending block number (inclusive) for the query. Use with `from_block`. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Use with `to_timestamp`. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. Use with `from_timestamp`. Validation rule:\ You must provide **either** a block range or a time range.\ Providing both results in HTTP 400.\ Providing none results in HTTP 400. #### Optional Filters Filter by sender address (hex string, 20 bytes, no `0x` prefix). Filter by recipient address (hex string, 20 bytes, no `0x` prefix). Filter by token contract address (hex string, 20 bytes, no `0x` prefix). Use `null` for native network token (e.g. ETH on Ethereum). Filter by transfer type integer code: `0`=native\_tx, `1`=native\_internal, `2`=erc20, `3`=erc721, `4`=erc1155. Omit to return all types. *See the [TransferType](/api-reference/enumerations/transfer-type) enumeration.* #### Pagination Controls Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Pagination cursor from a prior call. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Filter parameters echoed from the request (addresses, transfer\_type, pagination state, etc.). #### Data Each element mirrors the table columns (chain implied by `meta.chain_id`). Primary key in SQL is `_tracing_id`. Block where the transfer occurred. UTC timestamp of the block (ISO-8601). Transaction index within the block. Log index within the transaction receipt; null for native or internal tx transfers. Trace address for internal tx transfers (e.g. `"0"`, `"0.1"`); null for log-based transfers. Sender address (hex string, 20 bytes, no `0x` prefix). Recipient address (hex string, 20 bytes, no `0x` prefix). Token contract address (hex string, 20 bytes); null for native ETH. Raw amount in smallest unit (wei for native, raw uint256 for ERC-20/1155). String to preserve precision. Decimal-adjusted amount; null if decimals unknown or NFT (ERC-721). Token ID for ERC-721 and ERC-1155; null for native/ERC-20. String to preserve precision. Transfer type as integer enum: `0`=native\_tx, `1`=native\_internal, `2`=erc20, `3`=erc721, `4`=erc1155. *See the [TransferType](/api-reference/enumerations/transfer-type) enumeration.* BlockDB lineage identifier (hex string, no `0x` prefix). BlockDB lineage identifiers of the parent records. Record creation timestamp, e.g. `"2025-11-11T18:42:15.123Z"`. Last update timestamp in the same format. #### Envelope Fields Cursor token for pagination. Number of records returned in `data`. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/transfers/token-transfers" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "from_address": "0000000000000000000000000000000000000000", "to_address": "0000000000000000000000000000000000000001", "token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "transfer_type": [2, 3], "limit": 250, "cursor": null }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"from_block\":12345678,\"to_block\":12345999,\"limit\":250,\"cursor\":null}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/transfers/token-transfers"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"from_block\":12345678,\"to_block\":12345999,\"limit\":250,\"cursor\":null}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/transfers/token-transfers", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/transfers/token-transfers", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z", "transfer_type": [2, 3], "limit": 250, "cursor": None } ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/transfers/token-transfers", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ chain_id: 1, from_block: 12345678, to_block: 12345999, from_timestamp: "2025-10-29T00:00:00Z", to_timestamp: "2025-11-11T00:00:00Z", transfer_type: ["erc20", "erc721"], limit: 250, cursor: null }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "from_block": 12345678, "to_block": 12345999, "limit": 250, "cursor": null }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/transfers/token-transfers", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "request_window": { "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z" }, "resolved_window": { "from_block": 12345678, "to_block": 12345999, "from_timestamp": "2025-10-29T00:00:00Z", "to_timestamp": "2025-11-11T00:00:00Z" }, "filters": { "transfer_type": [ 2, 3 ], "limit": 250, "cursor": null } }, "data": [ { "block_number": 12345680, "block_time": "2025-10-29T00:01:23Z", "tx_index": 5, "log_index": 2, "trace_address": null, "from_address": "0000000000000000000000000000000000000000", "to_address": "0000000000000000000000000000000000000001", "token_address": "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "amount_raw": "1000000000000000000", "amount_adj": "1.0", "token_id": null, "transfer_type": 2, "_tracing_id": "0304000000000000000000000000000000000001", "_parent_tracing_ids": [ "0102000000000000000000000000000000000001", "0201000000000000000000000000000000000001" ], "_created_at": "2025-11-11T18:42:15.123Z", "_updated_at": "2025-11-11T18:42:15.123Z" }, { "block_number": 12345681, "block_time": "2025-10-29T00:02:00Z", "tx_index": 12, "log_index": 0, "trace_address": null, "from_address": "bc4ca0eda7647a8ab7c2061c2e118a18a936f13d", "to_address": "0000000000000000000000000000000000000002", "token_address": "bc4ca0eda7647a8ab7c2061c2e118a18a936f13d", "amount_raw": "1", "amount_adj": null, "token_id": "1234", "transfer_type": 3, "_tracing_id": "0304000000000000000000000000000000000002", "_parent_tracing_ids": [ "0102000000000000000000000000000000000001", "0201000000000000000000000000000000000001" ], "_created_at": "2025-11-11T18:42:15.123Z", "_updated_at": "2025-11-11T18:42:15.123Z" } ], "cursor": "next_page_cursor", "page_count": 2 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "body", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_block", "location": "body", "reason": "required_with", "expected": "provide either block range (from_block + to_block) or time range (from_timestamp + to_timestamp)" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by from_address, to_address, token_address, or transfer_type" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # TVL Overview Source: https://docs.blockdb.io/api-reference/evm/tvl/overview Access Total Value Locked (TVL) snapshots in USD for liquidity pools across chains. ## Overview The TVL endpoint provides Total Value Locked snapshots in USD for liquidity pools. Each snapshot represents the pool's total value computed from reserves multiplied by fiat prices, providing a standardized USD-denominated measure of pool liquidity at each on-chain event. ### Endpoint Matrix | Endpoint | Summary | Dataset ID | Typical Latency | | ------------------------------------------------- | ------------------------- | ---------- | --------------- | | [`POST /evm/tvl`](/api-reference/evm/tvl/tvl-usd) | Pool TVL snapshots in USD | `0701` | \< 300 ms | ### Parameter Conventions Chain identifier for the target EVM network. See [Chain enumeration](/api-reference/enumerations/chain) for supported values. Starting block height (inclusive) for TVL snapshots. Ending block height (inclusive) for TVL snapshots. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. BlockDB pool identifiers for filtering TVL data by pool. Pool contract addresses to scope TVL data. Minimum TVL threshold in USD for filtering pools. ### Usage Guidance * **Pool ranking** — Use TVL to rank pools by liquidity depth * **Liquidity migration** — Track TVL changes over time to identify liquidity flows * **Protocol health** — Monitor aggregate TVL across pools for protocol-level metrics * **Risk assessment** — Filter pools by minimum TVL for routing and execution quality * **Dashboards** — Build TVL charts and leaderboards with full provenance ### TVL Calculation TVL is computed as: ``` tvl_usd = sum(token_amounts[i] x fiat_price[i]) ``` Where: * `token_amounts[i]` is the decimals-adjusted reserve amount for token `i` * `fiat_price[i]` is the USD price for token `i` at the snapshot time ### Common Patterns **Rank pools by TVL:** ```json theme={null} { "chain_id": 1, "from_timestamp": "2025-12-01T00:00:00Z", "to_timestamp": "2025-12-20T00:00:00Z", "min_tvl_usd": 1000000 } ``` **Get TVL history for specific pools:** ```json theme={null} { "chain_id": 1, "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "from_block": 19000000, "to_block": 19100000 } ``` ### Dataset Relationships * **Reserves → TVL**: Reserve snapshots provide token amounts for TVL calculation * **Prices → TVL**: Fiat prices provide USD conversion for TVL * **Pools → TVL**: Join pool metadata to TVL snapshots using `pool_uid` * **TVL → Yields**: TVL can be used alongside yields for liquidity-adjusted ROI analysis ### See Also * [`POST /evm/tvl`](/api-reference/evm/tvl/tvl-usd) — TVL snapshots endpoint * [`POST /evm/reserves`](/api-reference/evm/reserves/reserves) — Pool reserves (input to TVL) * [`POST /evm/entities/pools`](/api-reference/evm/entities/pools) — Pool metadata registry * [`POST /evm/yields`](/api-reference/evm/yields/yields) — Yield predictions * [Pool Type](/api-reference/enumerations/pool-type) — AMM pool classifications # TVL USD Source: https://docs.blockdb.io/api-reference/evm/tvl/tvl-usd POST https://api.blockdb.io/v1/evm/tvl Read pool Total Value Locked (TVL) snapshots in USD. **Not publicly available:** This dataset is not included in the standard public API. Request access via a custom plan — contact [support@blockdb.io](mailto:support@blockdb.io). ## Overview * **Dataset ID:** [`0701 - Liquidity Pool TVL (USD)`](/data-catalog/evm/tvl/liquidity-pools-tvl-usd) * **Description:** Pool TVL (Total Value Locked) snapshots in USD, computed from reserves multiplied by fiat prices. Grain: one row per (pool, event triple); `pool_uid` → `blockdb_evm.b0211_liquidity_pools_v1`. * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/Liquidity-Pools-TVL-USD-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0701_liquidity_pools_tvl_usd_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/Liquidity-Pools-TVL-USD-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0701_liquidity_pools_tvl_usd_v1.json?download=true) ## Parameters Target EVM network. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.* #### Range Filters (mutually exclusive) Starting block number (inclusive) for the query. Use with `to_block`. Ending block number (inclusive) for the query. Use with `from_block`. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Use with `to_timestamp`. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. Use with `from_timestamp`. Validation rule:\ You must provide **either** a block range, a time range, or at least one direct selector.\ Providing more than one option results in HTTP 400.\ Providing none results in HTTP 400. #### Pool Selectors Filter pools by exchange IDs. *See the [DigitalExchange](/api-reference/enumerations/digital-exchange) enumeration for supported values.* Filter by BlockDB pool identifiers (`uid` from `/evm/entities/pools`). Filter by pool contract addresses (hex string, 20 bytes, no `0x` prefix). Filter by AMM archetype. *See the [PoolType](/api-reference/enumerations/pool-type) enumeration for supported values.* #### TVL Filters Minimum TVL threshold in USD. Maximum TVL threshold in USD. #### Pagination Controls Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Pagination cursor from a prior call. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Filters echoed from the request (selectors, TVL filters, pagination state, etc.). #### Data Array of TVL snapshot records matching the request. BlockDB pool identifier — 32-byte `pool_uid` (`uid` from `/evm/entities/pools`). Exchange / DEX identifier for the pool. Pool type identifier (AMM archetype). Block height of the TVL snapshot. UTC timestamp of the TVL snapshot. Zero-based transaction index within the block. Zero-based log index within the transaction. Array of token amounts (decimals-adjusted), aligned with pool tokens. Returned as strings to preserve precision. Total value locked in USD. Returned as a string to preserve precision. Row-level lineage hash (hex string, no `0x` prefix). Lineage references of immediate parents. Record creation timestamp (ISO-8601). Last update timestamp (ISO-8601). #### Envelope Fields Cursor token for pagination. Number of records returned in `data`. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/tvl" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "from_timestamp": "2025-12-01T00:00:00Z", "to_timestamp": "2025-12-20T00:00:00Z", "min_tvl_usd": 1000000, "limit": 250 }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"pool_uids\":[\"88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000\"],\"from_timestamp\":\"2025-12-01T00:00:00Z\",\"to_timestamp\":\"2025-12-20T00:00:00Z\",\"min_tvl_usd\":1000000,\"limit\":250}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/tvl"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"pool_uids\":[\"88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000\"],\"from_timestamp\":\"2025-12-01T00:00:00Z\",\"to_timestamp\":\"2025-12-20T00:00:00Z\",\"min_tvl_usd\":1000000,\"limit\":250}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/tvl", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/tvl", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={ 'chain_id': 1, 'pool_uids': ['88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000'], 'from_timestamp': '2025-12-01T00:00:00Z', 'to_timestamp': '2025-12-20T00:00:00Z', 'min_tvl_usd': 1000000, 'limit': 250 } ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/tvl", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "from_timestamp": "2025-12-01T00:00:00Z", "to_timestamp": "2025-12-20T00:00:00Z", "min_tvl_usd": 1000000, "limit": 250 }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "from_timestamp": "2025-12-01T00:00:00Z", "to_timestamp": "2025-12-20T00:00:00Z", "min_tvl_usd": 1000000, "limit": 250 }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/tvl", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "request_window": { "from_block": null, "to_block": null, "from_timestamp": "2025-12-01T00:00:00Z", "to_timestamp": "2025-12-20T00:00:00Z" }, "resolved_window": { "from_block": 21640000, "to_block": 21775000, "from_timestamp": "2025-12-01T00:00:00Z", "to_timestamp": "2025-12-20T00:00:00Z" }, "filters": { "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "min_tvl_usd": 1000000, "limit": 250, "cursor": null } }, "data": [ { "pool_uid": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000", "exchange_id": 1, "type_id": 201, "block_number": 19001234, "block_time": "2025-12-20T12:34:56Z", "tx_index": 7, "log_index": 12, "token_amounts": [ "1250.000000000000000000", "3950000.000000000000000000" ], "tvl_usd": "8750000.00", "_tracing_id": "0701c0ffee000000000000000000000000000000000000000000000000000001", "_parent_tracing_ids": [ "0301c0ffee000000000000000000000000000000000000000000000000000001" ], "_created_at": "2025-12-20T12:35:01Z", "_updated_at": "2025-12-20T12:35:01Z" } ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or contract addresses" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Verification Overview Source: https://docs.blockdb.io/api-reference/evm/verification/overview Stateless utilities for recomputing Ethereum integrity artifacts. ## Overview The verification suite provides stateless utilities for recomputing canonical Ethereum consensus artifacts. These endpoints help you validate data integrity before committing BlockDB exports (or third-party feeds) into regulated archives and downstream analytics. ### Endpoint Matrix | Endpoint | Purpose | Inputs Expected | Typical Latency | | -------------------------------------------------------------------------------------- | -------------------------------------------------- | --------------------- | --------------- | | [`POST /evm/verify/receipt-root`](/api-reference/evm/verification/verify-receipt-root) | Recompute and compare the block receipt trie root. | Full receipt set. | \< 300 ms | | [`POST /evm/verify/logs-bloom`](/api-reference/evm/verification/verify-logs-bloom) | Recompute a logs bloom filter for a set of events. | Log addresses/topics. | \< 50 ms | ### Usage Guidance * Use `receipt-root` for full-block reconciliations when you already possess the entire receipt set. * Prefer `logs-bloom` for lightweight event checks to avoid recomputing entire tries. * All endpoints accept arbitrary data providers; discrepancies in the response surface the exact hash mismatch to speed debugging. ### See Also * [`POST /evm/verify/receipt-root`](/api-reference/evm/verification/verify-receipt-root) * [`POST /evm/verify/logs-bloom`](/api-reference/evm/verification/verify-logs-bloom) # Verify Logs Bloom Source: https://docs.blockdb.io/api-reference/evm/verification/verify-logs-bloom POST https://api.blockdb.io/v1/evm/verify/logs-bloom Regenerate logs bloom filters for targeted reconciliations. ## Overview Recomputes an Ethereum receipt logs bloom filter from the logs you supply and compares it against an expected bloom (for example, the value published in a block header or receipt). Useful when you only care about log-topic coverage without re-verifying the full receipt trie. ## Parameters Network identifier. Use when the verification workflow should be tied to a specific chain context. *See the [Chain](/api-reference/enumerations/chain) enumeration.* #### Block Context Canonical block height where the log was emitted. Use when the verification workflow should be tied to a specific block height context. 2048-bit bloom filter represented as a 512-character hex string (no `0x` prefix). Typically sourced from a block header or receipt. #### Log Inputs Logs that should populate the bloom filter. Order is irrelevant. Address that emitted the log (hex string, 20 bytes, no `0x` prefix). Encoded into the bloom. 0-4 indexed topics (hex string, 32 bytes each, no `0x` prefix). Each topic contributes to the bloom. Supply an empty array for topic-less logs. #### Pagination Controls Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Pagination cursor from a prior call. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request when provided; otherwise `null`. #### Data Verification results. Bloom filter supplied in the request. Bloom filter recomputed from `logs`. `true` when `expected_bloom` and `computed_bloom` match bit-for-bit. #### Envelope Fields Number of verification entries returned (currently `1`). ## Use Cases * Sanity-check log ingestion pipelines without fetching receipts or recomputing trie roots. * Confirm that filtered event subscriptions captured all expected topics before downstream processing. * Lightweight guardrail for block producers or relayers to ensure bloom accuracy after custom transformations. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/verify/logs-bloom" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "block_number": 18767124, "expected_bloom": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "logs": [ { "contract_address": "0000000000000000000000000000000000000000", "topics": [ "ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "0000000000000000000000000000000000000000000000000000000000000000" ] } ] }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"block_number\":18767124,\"expected_bloom\":\"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\"logs\":[{\"contract_address\":\"0000000000000000000000000000000000000000\",\"topics\":[\"ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\",\"0000000000000000000000000000000000000000000000000000000000000000\"]}]}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/verify/logs-bloom"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"block_number\":18767124,\"expected_bloom\":\"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\"logs\":[{\"contract_address\":\"0000000000000000000000000000000000000000\",\"topics\":[\"ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\",\"0000000000000000000000000000000000000000000000000000000000000000\"]}]}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/verify/logs-bloom", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/verify/logs-bloom", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={'block_number': 18767124, 'chain_id': 1, 'expected_bloom': '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', 'logs': [{'contract_address': '0000000000000000000000000000000000000000', 'topics': ['ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0000000000000000000000000000000000000000000000000000000000000000']}]} ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/verify/logs-bloom", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "block_number": 18767124, "expected_bloom": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "logs": [ { "contract_address": "0000000000000000000000000000000000000000", "topics": [ "ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "0000000000000000000000000000000000000000000000000000000000000000" ] } ] }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "block_number": 18767124, "expected_bloom": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "logs": [ { "contract_address": "0000000000000000000000000000000000000000", "topics": [ "ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "0000000000000000000000000000000000000000000000000000000000000000" ] } ] }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/verify/logs-bloom", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1 }, "data": [ { "expected_bloom": "0000…", "computed_bloom": "0000…", "is_identical": true } ], "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "message": "Invalid request parameters" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "message": "Invalid or missing API key" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "message": "Rate limit exceeded", "details": "Limit: requests/second. Retry after: " } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Verify Receipt Root Source: https://docs.blockdb.io/api-reference/evm/verification/verify-receipt-root POST https://api.blockdb.io/v1/evm/verify/receipt-root Recompute and compare canonical receipt trie roots. ## Overview Validates a block's receipt Merkle root by recomputing it from the receipts you provide. Use this endpoint to independently confirm that BlockDB (or any upstream source) delivered a complete, ordered receipt set. ## Parameters EVM network identifier. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.* #### Block Context Canonical block height whose receipts you want to verify. Block hash (hex string, 32 bytes, no `0x` prefix). Acts as a guard to ensure you are verifying the intended block. Receipt trie root reported by your data source (e.g., the block header). The endpoint recomputes the root from the supplied receipts and compares it to this value. #### Transaction Inputs Complete list of transaction receipts for the block (order-insensitive). Zero-based transaction index within the block. Post-Byzantium execution status (`1` = success, `0` = revert). Mutually exclusive with `root`. Pre-Byzantium state root (hex string, 32 bytes, no `0x` prefix). Provide only for receipts before Byzantium; omit or set to `null` for modern blocks. Total gas consumed in the block up to and including this transaction. Logs emitted by the transaction. Address emitting the log (hex string, 20 bytes, no `0x` prefix). 0-4 indexed topics (hex string, 32 bytes each, no `0x` prefix) in emission order. May be empty. Hex-encoded ABI payload (hex string, even length, no `0x` prefix). Use `"0x"` when empty. #### Pagination Controls Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Pagination cursor from a prior call. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. #### Data Array of verification results (currently one per request). Sequential block height. Keccak-256 hash of the block header (hex string, 32 bytes, no `0x` prefix). Keccak-256 hash of the parent block. Receipt trie root sourced from the request. Root recomputed from the supplied receipts. `true` when `computed_receipt_root` matches `receipt_root`; otherwise `false`. #### Envelope Fields Reserved for future pagination. Number of result objects in `data`. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/verify/receipt-root" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "block_number": 18767124, "block_hash": "7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0", "receipt_root": "b4d8cfe4b87590afe7ed95fbf7798142e8fb1ce86307ff0eb6580b8bc23de92f", "transactions": [ { "index": 0, "status": 1, "root": null, "cumulative_gas_used": 21000, "logs": [ { "contract_address": "0000000000000000000000000000000000000000", "topics": [ "ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000000" ], "data": "0x" } ] } ] }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"block_number\":18767124,\"block_hash\":\"7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0\",\"receipt_root\":\"b4d8cfe4b87590afe7ed95fbf7798142e8fb1ce86307ff0eb6580b8bc23de92f\",\"transactions\":[{\"index\":0,\"status\":1,\"root\":null,\"cumulative_gas_used\":21000,\"logs\":[{\"contract_address\":\"0000000000000000000000000000000000000000\",\"topics\":[\"ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\",\"0000000000000000000000000000000000000000000000000000000000000000\",\"0000000000000000000000000000000000000000000000000000000000000000\"],\"data\":\"0x\"}]}]}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/verify/receipt-root"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"block_number\":18767124,\"block_hash\":\"7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0\",\"receipt_root\":\"b4d8cfe4b87590afe7ed95fbf7798142e8fb1ce86307ff0eb6580b8bc23de92f\",\"transactions\":[{\"index\":0,\"status\":1,\"root\":null,\"cumulative_gas_used\":21000,\"logs\":[{\"contract_address\":\"0000000000000000000000000000000000000000\",\"topics\":[\"ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\",\"0000000000000000000000000000000000000000000000000000000000000000\",\"0000000000000000000000000000000000000000000000000000000000000000\"],\"data\":\"0x\"}]}]}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/verify/receipt-root", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/verify/receipt-root", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={'block_hash': '7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0', 'block_number': 18767124, 'chain_id': 1, 'receipt_root': 'b4d8cfe4b87590afe7ed95fbf7798142e8fb1ce86307ff0eb6580b8bc23de92f', 'transactions': [{'cumulative_gas_used': 21000, 'index': 0, 'logs': [{'contract_address': '0000000000000000000000000000000000000000', 'data': '0x', 'topics': ['ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0000000000000000000000000000000000000000000000000000000000000000', '0000000000000000000000000000000000000000000000000000000000000000']}], 'root': None, 'status': 1}]} ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/verify/receipt-root", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "block_number": 18767124, "block_hash": "7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0", "receipt_root": "b4d8cfe4b87590afe7ed95fbf7798142e8fb1ce86307ff0eb6580b8bc23de92f", "transactions": [ { "index": 0, "status": 1, "root": null, "cumulative_gas_used": 21000, "logs": [ { "contract_address": "0000000000000000000000000000000000000000", "topics": [ "ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000000" ], "data": "0x" } ] } ] }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "block_number": 18767124, "block_hash": "7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0", "receipt_root": "b4d8cfe4b87590afe7ed95fbf7798142e8fb1ce86307ff0eb6580b8bc23de92f", "transactions": [ { "index": 0, "status": 1, "root": null, "cumulative_gas_used": 21000, "logs": [ { "contract_address": "0000000000000000000000000000000000000000", "topics": [ "ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000000" ], "data": "0x" } ] } ] }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/verify/receipt-root", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1 }, "data": [ { "block_number": 18767124, "block_hash": "7b5c0972efb6a0b5be4a4d4a0de5d1abd922478a53f32b2c717a800c862ba9e0", "parent_block_hash": "8a1e67f5d30a6a56f5afc7f9deee5ee97d6af872637dcf71aa41cc403baba2d2", "receipt_root": "b4d8cfe4b87590afe7ed95fbf7798142e8fb1ce86307ff0eb6580b8bc23de92f", "computed_receipt_root": "b4d8cfe4b87590afe7ed95fbf7798142e8fb1ce86307ff0eb6580b8bc23de92f", "is_identical": true } ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or exchanges" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, # configured rate limit "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Yields Overview Source: https://docs.blockdb.io/api-reference/evm/yields/overview Access rolling pool yield/ROI predictions across fixed horizons for pool allocation and performance analysis. ## Overview The Yields endpoint provides rolling yield/ROI predictions per pool across fixed time horizons (1D, 3D, 7D, 14D, 30D, 90D, 365D). Each prediction is anchored to a specific block/log position and includes aligned arrays for pool tokens, current reserves, observed/predicted volumes, user fees, and ROI fractions. Predictions are derived from historical swap fees and current reserve states. ### Endpoint Matrix | Endpoint | Summary | Dataset ID | Typical Latency | | ------------------------------------------------------ | ------------------------------------------------ | ---------- | --------------- | | [`POST /evm/yields`](/api-reference/evm/yields/yields) | Pool yield/ROI predictions across fixed horizons | `0411` | \< 300 ms | ### Parameter Conventions Chain identifier for the target EVM network. See [Chain enumeration](/api-reference/enumerations/chain) for supported values. Target prediction horizon in days. Supported values: 1, 3, 7, 14, 30, 90, 365. Starting block height (inclusive) for yield predictions. Ending block height (inclusive) for yield predictions. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. BlockDB pool identifiers for filtering yield predictions by pool. Pool contract addresses to scope yield data. Only return predictions where `observed_period_days == target_period_days` (no extrapolation). Minimum ROI threshold for filtering predictions. ### Usage Guidance * **Pool ranking** — Use yield predictions to rank pools by expected fee yield over a horizon * **Allocation screens** — Build pool allocation signals using APR/ROI predictions with full provenance * **Model validation** — Compare yield predictions against actual swap fees and reserves for backtesting * **Horizon selection** — Choose `target_period_days` based on your investment horizon (short-term vs long-term) * **Full period filtering** — Use `require_full_period: true` to exclude extrapolated predictions when historical data is insufficient ### Yield Calculation Yield predictions are computed using: * **Historical swap fees** (from `/evm/swaps/fees`) — Observed fee amounts over the available window * **Current reserves** (from `/evm/reserves`) — Current pool state for ROI denominator * **Extrapolation** — When `observed_period_days < target_period_days`, predictions are scaled by `target_period_days / observed_period_days` ROI per token: `roi_predicted[i] = user_fees_predicted[i] / current_reserves[i]` ### Prediction Quality Indicators Each yield record includes quality indicators: * `observed_period_days`: Actual days of history used * `is_full_period`: `true` when `observed_period_days == target_period_days` * `is_extrapolated`: `true` when history is shorter than target * `extrapolation_factor`: Scaling factor applied (target / observed) ### Common Patterns **Rank pools by 30-day yield:** ```json theme={null} { "chain_id": 1, "target_period_days": 30, "require_full_period": true, "from_timestamp": "2025-12-01T00:00:00Z", "to_timestamp": "2025-12-20T00:00:00Z" } ``` **Get yield predictions for specific pools:** ```json theme={null} { "chain_id": 1, "target_period_days": 7, "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "from_block": 19000000 } ``` **Filter by minimum ROI:** ```json theme={null} { "chain_id": 1, "target_period_days": 30, "min_roi": 0.05, "require_full_period": true } ``` ### Dataset Relationships * **Swap Fees → Yields**: Historical swap fees are the primary input for yield predictions * **Reserves → Yields**: Current reserves provide the denominator for ROI calculations * **Pools → Yields**: Join pool metadata to yield predictions using `pool_uid` * **Fee Terms → Yields**: Fee terms determine which fees are attributed to LPs/users * **Yields → Prices**: Yield predictions can inform pricing models for pool tokens ### See Also * [`POST /evm/yields`](/api-reference/evm/yields/yields) — Yield/ROI predictions endpoint * [`POST /evm/swaps/fees`](/api-reference/evm/swaps/swap-fees) — Historical swap fees (input to yield models) * [`POST /evm/reserves`](/api-reference/evm/reserves/reserves) — Current pool reserves (input to yield models) * [`POST /evm/entities/pools/fee-terms`](/api-reference/evm/entities/fee-terms) — Pool fee configuration * [`POST /evm/entities/pools`](/api-reference/evm/entities/pools) — Pool metadata registry * [Pool Type](/api-reference/enumerations/pool-type) — AMM pool classifications # Yields Source: https://docs.blockdb.io/api-reference/evm/yields/yields POST https://api.blockdb.io/v1/evm/yields Read rolling pool yield/ROI predictions across fixed horizons, derived from swap fees and current reserves. **Not publicly available:** This dataset is not included in the standard public API. Request access via a custom plan — contact [support@blockdb.io](mailto:support@blockdb.io). ## Overview * **Dataset ID:** [`0411 - Liquidity Pool Yields`](/data-catalog/evm/yields/liquidity-pools-yields) * **Description:** Rolling yield/ROI predictions per pool over fixed horizons (1D, 3D, 7D, 14D, 30D, 90D, 365D), based on historical swap fees (blockdb\_evm.b0303\_liquidity\_pools\_swap\_fees\_v1) and current reserves (latest blockdb\_evm.b0301\_liquidity\_pools\_reserves\_v1 snapshot). * **CSV Sample:** [Download](https://huggingface.co/datasets/BlockDB/Liquidity-Pools-Yields-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0411_liquidity_pools_yields_v1.csv?download=true) * **JSON Sample:** [Download](https://huggingface.co/datasets/BlockDB/Liquidity-Pools-Yields-Ethereum-And-EVM-Cryptocurrency-Data/resolve/main/data/blockdb_evm.b0411_liquidity_pools_yields_v1.json?download=true) ## Parameters Target EVM network. *See the [Chain](/api-reference/enumerations/chain) enumeration for supported values.* #### Range Filters (mutually exclusive) Starting block number (inclusive) for the query. Use with `to_block`. Ending block number (inclusive) for the query. Use with `from_block`. Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used. Use with `to_timestamp`. Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used. Use with `from_timestamp`. Validation rule:\ You must provide **either** a block range, a time range, or at least one direct selector.\ Providing more than one option results in HTTP 400.\ Providing none results in HTTP 400. #### Pool Selectors Filter pools by exchange IDs. *See the [DigitalExchange](/api-reference/enumerations/digital-exchange) enumeration for supported values.* Filter by BlockDB pool identifiers (`uid` from `/evm/entities/pools`). Filter by pool contract addresses (hex string, 20 bytes, no `0x` prefix). Filter by protocol-specific pool identifiers (e.g., Uniswap V4 `pool_id`). Filter by AMM archetype. *See the [PoolType](/api-reference/enumerations/pool-type) enumeration for supported values.* #### Horizon & Token Filters Target horizon in days. Allowed values: `1, 3, 7, 14, 30, 90, 365`. Restrict to pools that contain at least one of these tokens (hex string, 20 bytes, no `0x` prefix). If `true`, returns only rows where `observed_period_days == target_period_days` (no extrapolation). #### Pagination Controls Recommended default `250`; maximum `1000` to stay under \~10 MB responses. Pagination cursor from a prior call. ## Response Fields #### Meta Echo of request metadata applied to the response. EVM chain ID echoed from the request. Pure echo of the window you sent (`from_block`/`to_block`/`from_timestamp`/`to_timestamp`); unset bounds are `null`. The concrete window the query actually executed against, after resolving the request. For a **block range** on a time-bucketed endpoint (OHLC/VWAP/VWAP-aggregate/fiat VWAP), `from_timestamp`/`to_timestamp` hold the resolved timestamp window (and `from_block`/`to_block` echo your request). For a **time range** on a block-keyed endpoint, `from_block`/`to_block` hold the resolved block range (and the timestamps echo your request). `null` for selector-only requests (no window). No extra database work is done — these are the values the query already computed. Resolved/echoed start block of the executed window. Resolved/echoed end block of the executed window. Resolved/echoed start timestamp (ISO-8601) of the executed window. Resolved/echoed end timestamp (ISO-8601) of the executed window. Filters echoed from the request (selectors, horizon filters, pagination state, etc.). #### Data Array of yield/ROI prediction records matching the request. Rows are keyed by `(pool_uid, target_period_days, block_number, tx_index, log_index)`; there is no separate numeric `id` field. BlockDB pool identifier (`uid` from `/evm/entities/pools`). Exchange/DEX identifier. Pool type identifier. Block height of the as-of snapshot anchor. UTC timestamp of the as-of snapshot anchor. Zero-based transaction index within the block. Zero-based log index within the transaction. Target horizon in days (1, 3, 7, 14, 30, 90, 365). Observed history actually used to produce the prediction. `true` when `observed_period_days == target_period_days`. `true` when the row is scaled from shorter history. Scaling factor applied when extrapolating. Returned as a string to preserve precision. Start time of the observed window used for aggregation. End time of the observed window used for aggregation. Pool token addresses. All array-valued metrics are aligned to this order. Current reserves per token (decimals-adjusted). Returned as strings to preserve precision. Observed traded volume per token in the observed window. Predicted traded volume per token for the target horizon. Observed user/LP fee amounts per token in the observed window. Predicted user/LP fee amounts per token for the target horizon. Predicted ROI fractions per token for the target horizon. Row-level lineage hash (hex string, no `0x` prefix). Lineage references of immediate parents. Record creation timestamp (ISO-8601). Last update timestamp (ISO-8601). #### Envelope Fields Cursor token for pagination. Number of records returned in `data`. ```bash cURL theme={null} curl -X POST "https://api.blockdb.io/v1/evm/yields" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 1, "target_period_days": 30, "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "from_timestamp": "2025-12-01T00:00:00Z", "to_timestamp": "2025-12-20T00:00:00Z", "require_full_period": true, "limit": 250 }' ``` ```c C theme={null} #include #include #include int main(void) { CURL *curl = curl_easy_init(); if (!curl) return 1; const char *token = getenv("BLOCKDB_API_KEY"); char auth_header[256]; snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", token ? token : ""); const char *payload = "{\"chain_id\":1,\"target_period_days\":30,\"pool_uids\":[\"88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000\"],\"from_timestamp\":\"2025-12-01T00:00:00Z\",\"to_timestamp\":\"2025-12-20T00:00:00Z\",\"require_full_period\":true,\"limit\":250}"; struct curl_slist *headers = NULL; headers = curl_slist_append(headers, auth_header); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.blockdb.io/v1/evm/yields"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); CURLcode res = curl_easy_perform(curl); curl_slist_free_all(headers); curl_easy_cleanup(curl); return res == CURLE_OK ? 0 : 1; } ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; class Program { static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")); var payload = new StringContent( "{\"chain_id\":1,\"target_period_days\":30,\"pool_uids\":[\"88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000\"],\"from_timestamp\":\"2025-12-01T00:00:00Z\",\"to_timestamp\":\"2025-12-20T00:00:00Z\",\"require_full_period\":true,\"limit\":250}", Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.blockdb.io/v1/evm/yields", payload); response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } } ``` ```python Python theme={null} import os import requests response = requests.post( "https://api.blockdb.io/v1/evm/yields", headers={ "Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}", "Content-Type": "application/json" }, json={'chain_id': 1, 'target_period_days': 30, 'pool_uids': ['88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000'], 'from_timestamp': '2025-12-01T00:00:00Z', 'to_timestamp': '2025-12-20T00:00:00Z', 'require_full_period': True, 'limit': 250} ) data = response.json() print(data) ``` ```javascript Node.js theme={null} const response = await fetch("https://api.blockdb.io/v1/evm/yields", { method: "POST", headers: { "Authorization": `Bearer ${process.env.BLOCKDB_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "chain_id": 1, "target_period_days": 30, "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "from_timestamp": "2025-12-01T00:00:00Z", "to_timestamp": "2025-12-20T00:00:00Z", "require_full_period": true, "limit": 250 }) }); const data = await response.json(); console.log(data); ``` ```go Go theme={null} package main import ( "fmt" "net/http" "os" "strings" ) func main() { payload := strings.NewReader(`{ "chain_id": 1, "target_period_days": 30, "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "from_timestamp": "2025-12-01T00:00:00Z", "to_timestamp": "2025-12-20T00:00:00Z", "require_full_period": true, "limit": 250 }`) req, _ := http.NewRequest("POST", "https://api.blockdb.io/v1/evm/yields", payload) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", os.Getenv("BLOCKDB_API_KEY"))) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() // Handle response } ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "request_window": { "from_timestamp": "2025-12-01T00:00:00Z", "to_timestamp": "2025-12-20T00:00:00Z" }, "resolved_window": { "from_block": 21640000, "to_block": 21775000, "from_timestamp": "2025-12-01T00:00:00Z", "to_timestamp": "2025-12-20T00:00:00Z" }, "filters": { "pool_uids": [ "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000" ], "target_period_days": 30, "require_full_period": true, "limit": 250, "cursor": null } }, "data": [ { "pool_uid": "88e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000", "exchange_id": 1, "type_id": 201, "block_number": 19001234, "block_time": "2025-12-20T12:34:56Z", "tx_index": 7, "log_index": 12, "target_period_days": 30, "observed_period_days": 30, "is_full_period": true, "is_extrapolated": false, "extrapolation_factor": "1.000000", "window_start_time": "2025-11-20T12:34:56Z", "window_end_time": "2025-12-20T12:34:56Z", "tokens": [ "c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" ], "current_reserves": [ "1250.000000000000000000", "3950000.000000000000000000" ], "volume_observed": [ "12000.000000000000000000", "0.000000000000000000" ], "volume_predicted": [ "12000.000000000000000000", "0.000000000000000000" ], "user_fees_observed": [ "36.000000000000000000", "0.000000000000000000" ], "user_fees_predicted": [ "36.000000000000000000", "0.000000000000000000" ], "roi_predicted": [ "0.028800000000000000", "0.000000000000000000" ], "_tracing_id": "0411c0ffee000000000000000000000000000000000000000000000000000001", "_parent_tracing_ids": [ "0303c0ffee000000000000000000000000000000000000000000000000000001", "0301c0ffee000000000000000000000000000000000000000000000000000001" ], "_created_at": "2025-12-20T12:35:01Z", "_updated_at": "2025-12-20T12:35:01Z" } ], "cursor": null, "page_count": 1 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or exchanges" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, # configured rate limit "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Authorization Source: https://docs.blockdb.io/api-reference/overview/authorization API keys, the BlockDB dashboard, and how to send credentials on every request. ## Overview BlockDB authenticates **REST** and **WebSocket** traffic with **API keys**. Send your key in the `Authorization` header on every request that requires authentication. Keys are tied to your subscription: which datasets and chains you can query, your [compute unit](/api-reference/overview/compute-units) allowance, and your [rate limit](/api-reference/overview/rate-limiting). See the [dataset index](/data-catalog/evm/dataset-index) and [Dataset ID](/api-reference/enumerations/dataset-id) for how products map to `blockdb_evm` tables. There is **no separate token endpoint** and **no OAuth flow**. The string you copy from the dashboard is the credential you pass as `Bearer `. ## Get an account and API keys Sign up at [accounts.blockdb.io](https://accounts.blockdb.io/sign-up) if you do not already have a BlockDB account. Open **[dashboard.blockdb.io](https://dashboard.blockdb.io)**. There you can: * **Create** new API keys (up to **5 active keys** per account) * **Label** keys (for example production vs staging) * **Rotate** a key when you need a new secret while phasing out an old one * **Revoke** a key that is compromised or no longer needed Store keys only in environment variables or a secret manager—never commit them to source control. Use the HTTP `Authorization` header with the `Bearer` scheme: ``` Authorization: Bearer ``` ## Code examples: call the API with an API key Set **`BLOCKDB_API_KEY`** in your environment (or substitute the value from the dashboard). These examples use the historic REST base URL **`https://api.blockdb.io/v1`**. ```bash cURL theme={null} # Usage (no body) curl -sS "https://api.blockdb.io/v1/usage" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" # Example data request curl -sS -X POST "https://api.blockdb.io/v1/evm/raw/blocks" \ -H "Authorization: Bearer $BLOCKDB_API_KEY" \ -H "Content-Type: application/json" \ -d '{"chain_id":1,"from_block":12345678,"to_block":12345999,"limit":10}' ``` ```python Python theme={null} import os import requests API_BASE = "https://api.blockdb.io/v1" KEY = os.environ["BLOCKDB_API_KEY"] h = {"Authorization": f"Bearer {KEY}"} r = requests.get(f"{API_BASE}/usage", headers=h, timeout=30) r.raise_for_status() print(r.json()) r2 = requests.post( f"{API_BASE}/evm/raw/blocks", headers={**h, "Content-Type": "application/json"}, json={"chain_id": 1, "from_block": 12345678, "to_block": 12345999, "limit": 10}, timeout=30, ) r2.raise_for_status() print(r2.json()) ``` ```javascript Node.js theme={null} const API_BASE = "https://api.blockdb.io/v1"; const key = process.env.BLOCKDB_API_KEY; if (!key) throw new Error("Set BLOCKDB_API_KEY"); const headers = { Authorization: `Bearer ${key}` }; const usage = await fetch(`${API_BASE}/usage`, { headers }); console.log(await usage.json()); const blocks = await fetch(`${API_BASE}/evm/raw/blocks`, { method: "POST", headers: { ...headers, "Content-Type": "application/json" }, body: JSON.stringify({ chain_id: 1, from_block: 12345678, to_block: 12345999, limit: 10, }), }); console.log(await blocks.json()); ``` ```csharp .NET theme={null} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; var key = Environment.GetEnvironmentVariable("BLOCKDB_API_KEY") ?? throw new InvalidOperationException("Set BLOCKDB_API_KEY"); using var http = new HttpClient { BaseAddress = new Uri("https://api.blockdb.io/v1/") }; http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", key); var usage = await http.GetAsync("usage"); usage.EnsureSuccessStatusCode(); Console.WriteLine(await usage.Content.ReadAsStringAsync()); var body = new StringContent( """{"chain_id":1,"from_block":12345678,"to_block":12345999,"limit":10}""", Encoding.UTF8, "application/json"); var blocks = await http.PostAsync("evm/raw/blocks", body); blocks.EnsureSuccessStatusCode(); Console.WriteLine(await blocks.Content.ReadAsStringAsync()); ``` ### Official SDKs The [.NET](/api-reference/sdks/dotnet), [Python](/api-reference/sdks/python), and [JavaScript](/api-reference/sdks/javascript) SDKs accept your API key and attach `Authorization: Bearer` for you. See each SDK page for the exact constructor and configuration options. ## Security practices * **Rotation:** Create a new key in the dashboard, deploy it, then revoke the old key. * **Least privilege:** Use separate keys for production and non-production when possible (within the five-key limit). * **Incidents:** Revoke a key immediately if it leaks; create a replacement in the dashboard. ## See Also * [Usage & Limits](/api-reference/account-and-usage/usage) — `plan`, `cu_*`, and `rate_limit_rps` for your key * [Rate Limiting](/api-reference/overview/rate-limiting) — RPS, backoff, and `429` handling * [Error Codes](/api-reference/overview/error-codes) — Full error reference * [Troubleshooting: API Authentication Failures](/troubleshooting/runbooks/api-authentication-failures) — 401/403 runbook ```bash cURL theme={null} curl -X POST 'https://api.blockdb.io/v1/evm/raw/blocks' \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ -d '{ "chain_id": 1, "from_block": 12345678, "to_block": 12345999 }' ``` ```json 200 theme={null} { "meta": { "chain_id": 1, "request_window": { "from_block": 12345678, "to_block": 12345999 }, "filters": { "limit": 10, "cursor": null } }, "data": [], "cursor": null, "page_count": 0 } ``` ```json 400 theme={null} { "error": { "code": "BAD_REQUEST", "http_status": 400, "message": "The request contains invalid or missing parameters.", "hint": "Validate all required parameters against the endpoint specification before retrying.", "severity": "error", "retryable": false, "details": { "invalid_parameters": [ { "name": "chain_id", "location": "query", "reason": "missing", "expected": "positive integer, e.g. 1" }, { "name": "from_timestamp", "location": "query", "reason": "invalid_format", "expected": "ISO-8601 UTC timestamp, e.g. 2025-11-11T00:00:00Z" } ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/home" } } ``` ```json 401 theme={null} { "error": { "code": "UNAUTHORIZED", "http_status": 401, "message": "Invalid or missing API key.", "hint": "Ensure you send 'Authorization: Bearer ' in every request to this endpoint.", "severity": "error", "retryable": false, "details": { "auth_scheme": "bearer", "expected_header": "Authorization: Bearer ", "provided_header": "Authorization: ", "token_status": "invalid_or_missing", "recommendation": "Regenerate the API key if you suspect it is expired or compromised." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/authorization" } } ``` ```json 403 theme={null} { "error": { "code": "FORBIDDEN", "http_status": 403, "message": "Your API key does not have permission to access this endpoint.", "hint": "Upgrade your subscription tier or request additional access.", "severity": "warning", "retryable": false, "details": { "required_plan": "production", "your_plan": null, "contact": "support@blockdb.io", "recommendation": "Contact BlockDB Support Team via email support@blockdb.io." }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 404 theme={null} { "error": { "code": "NOT_FOUND", "http_status": 404, "message": "The requested resource does not exist.", "hint": "Verify the API endpoint", "severity": "warning", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 413 theme={null} { "error": { "code": "PAYLOAD_TOO_LARGE", "http_status": 413, "message": "The requested response exceeds the maximum allowed size of 10 MB.", "hint": "Reduce the limit, narrow the block or time window, or apply additional filters before retrying.", "details": { "max_allowed_bytes": 10485760, "estimated_response_bytes": 15360000, "recommended_actions": [ "Decrease the 'limit' parameter value", "Shorten the block range or time window", "Filter by fewer pools or exchanges" ] }, "docs_url": "https://docs.blockdb.io/api-reference/overview/pagination-and-limits" } } ``` ```json 422 theme={null} { "error": { "code": "CHAIN_NOT_SUPPORTED", "http_status": 422, "message": "chain_id=137 is not supported.", "hint": "Use a supported chain_id. Consult the documentation for the list of available chains.", "severity": "error", "retryable": false, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 429 theme={null} { "error": { "code": "RATE_LIMIT_EXCEEDED", "http_status": 429, "message": "You have exceeded the allowed request rate.", "hint": "Introduce client-side throttling or exponential backoff and respect the retry_after_seconds value.", "details": { "limit_rps": 1000, "current_estimated_rps": 73, "retry_after_seconds": 2, "limit_scope": "api_key", "limit_window_seconds": 1 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/rate-limiting" } } ``` ```json 500 theme={null} { "error": { "code": "INTERNAL_SERVER_ERROR", "http_status": 500, "message": "An unexpected server error occurred.", "hint": "This error is not caused by your request. You may retry after a short delay.", "severity": "critical", "retryable": true, "details": { "incident_id": "INC-2025-11-11-123456", "temporary_issue": true, "expected_recovery_seconds": 5 }, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ```json 503 theme={null} { "error": { "code": "SERVICE_UNAVAILABLE", "http_status": 503, "message": "The service is temporarily unable to handle the request.", "hint": "The database connection pool is briefly saturated. Retry after a short delay.", "severity": "warning", "retryable": true, "details": null, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` # Compute Units Source: https://docs.blockdb.io/api-reference/overview/compute-units API pricing based on Compute Units (CU): pay only for what you use, proportional to computational complexity. ## Compute Unit (CU) Pricing Model BlockDB uses a **Compute Unit (CU)** pricing model that charges based on the computational complexity of each API endpoint. This ensures you only pay for what you use, without being forced into expensive plans for simple queries. ### How Compute Units Work Each API request consumes a fixed number of Compute Units determined by the **data layer** — **not by result size or pagination depth**. Your **monthly CU allowance** (`cu_limit`, `cu_used`, `cu_remaining` on [`GET /usage`](/api-reference/account-and-usage/usage)) is **account-wide** and **shared by every API key**—adding keys does not create separate CU pools. The same applies to **RPS**; see [Rate limiting](/api-reference/overview/rate-limiting). | Level | CU / request | Endpoint Family | Endpoint | | :----: | :----------: | :--------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------- | | **L1** | **1 CU** | Raw history, blocks summary, lineage (parents), verification, JSON-RPC | [`evm/raw/blocks`](/api-reference/evm/primitives/blocks) | | | | | [`evm/raw/blocks-summary`](/api-reference/evm/primitives/blocks-summary) | | | | | [`evm/raw/transactions`](/api-reference/evm/primitives/transactions) | | | | | [`evm/raw/logs`](/api-reference/evm/primitives/logs) | | | | | [`evm/raw/contracts`](/api-reference/evm/primitives/contracts) | | | | | [`evm/raw/function-results`](/api-reference/evm/primitives/function-results) | | | | | [`evm/raw/internal-transactions`](/api-reference/evm/primitives/internal-transactions) | | | | | [`evm/lineage/parents`](/api-reference/evm/lineage/parents) | | | | | [`evm/verify/receipt-root`](/api-reference/evm/verification/verify-receipt-root) | | | | | [`evm/verify/logs-bloom`](/api-reference/evm/verification/verify-logs-bloom) | | | | | [`evm/rpc`](/api-reference/evm/rpc/overview) | | **L2** | **40 CU** | Entities, lineage (record) | [`evm/lineage/record`](/api-reference/evm/lineage/record) | | | | | [`evm/entities/tokens/erc20`](/api-reference/evm/entities/tokens-erc20) | | | | | [`evm/entities/tokens/erc721`](/api-reference/evm/entities/tokens-erc721) | | | | | [`evm/entities/tokens/erc1155`](/api-reference/evm/entities/tokens-erc1155) | | | | | [`evm/entities/pools`](/api-reference/evm/entities/pools) | | | | | [`evm/entities/pools/fee-terms`](/api-reference/evm/entities/fee-terms) | | **L3** | **80 CU** | Reserves, transfers, swaps, prints, flash loans | [`evm/reserves`](/api-reference/evm/reserves/reserves) | | | | | [`evm/reserves/liquidity-distribution`](/api-reference/evm/reserves/liquidity-distribution) | | | | | [`evm/transfers/token-transfers`](/api-reference/evm/transfers/token-transfers) | | | | | [`evm/swaps/fees`](/api-reference/evm/swaps/swap-fees) | | | | | [`evm/prices/spot/crypto/prints`](/api-reference/evm/prices/crypto/prices-spot-prints) | | | | | [`evm/flash-loans/prints`](/api-reference/evm/flash-loans/flash-loan-prints) | | **L4** | **80 CU** | Per-pool OHLC/VWAP | [`evm/prices/spot/crypto/vwap`](/api-reference/evm/prices/crypto/prices-spot-vwap) | | | | | [`evm/prices/spot/crypto/ohlc`](/api-reference/evm/prices/crypto/prices-spot-ohlc) | | | | | [`evm/yields`](/api-reference/evm/yields/yields) | | **L5** | **80 CU** | Cross-pool VWAP | [`evm/prices/spot/crypto/vwap-aggregate`](/api-reference/evm/prices/crypto/prices-spot-vwap-aggregate) | | **L6** | **100 CU** | Token-to-fiat VWAP | [`evm/prices/spot/fiat/vwap`](/api-reference/evm/prices/fiat/prices-spot-vwap-fiat) | | **L7** | **200 CU** | Pool TVL USD | [`evm/tvl`](/api-reference/evm/tvl/tvl-usd) | | **L8** | **300 CU** | Arbitrage path topology & path status | [`evm/arb/paths`](/api-reference/evm/arbitrage/arb-paths) | | | | | [`evm/arb/path-status`](/api-reference/evm/arbitrage/arb-path-status) | | **L9** | **1000 CU** | Arbitrage opportunities | [`evm/arb/opportunities`](/api-reference/evm/arbitrage/arb-opportunities) | CU consumption is calculated per request. Result size and pagination do not affect CU cost — only the endpoint level determines the CU value. ## CU Billing & Tracking ### How CU Consumption is Tracked Query the [`GET /usage`](/api-reference/account-and-usage/usage) endpoint to retrieve your plan, `cu_used`, `cu_remaining`, `cu_limit`, `cu_reset_at`, and `rate_limit_rps`. This endpoint is free to use and does not consume compute units. The `/usage` endpoint provides comprehensive usage data including consumption by dataset, billing period information, and rate limits. ### Overage Handling When you exceed your monthly CU allowance: * **Hard limits**: API requests are blocked once your CU allowance is exhausted * **Additional packages**: Purchase additional CU packages to continue using the API * **No automatic overage charges**: You control when to purchase additional CUs—no unexpected charges * **Package options**: Additional CU packages are available in various sizes to match your needs Once your CU allowance is exhausted, API requests will return `429 Too Many Requests` until you purchase an additional CU package. Plan your usage accordingly to avoid service interruptions. ## Pricing Examples ### Example 1: Raw block query (L1) ``` POST /evm/raw/blocks CU cost: 1 CU ``` ### Example 2: ERC-20 token lookup (L2) ``` POST /evm/entities/tokens/erc20 CU cost: 40 CU ``` ### Example 3: Fiat VWAP price (L5, dataset `0605`, `b0605_token_to_fiat_vwap`) ``` POST /evm/prices/spot/fiat/vwap CU cost: 100 CU ``` ### Example 4: Multi-step analysis workflow ``` POST /evm/raw/blocks (find block range) → 1 CU [L1] POST /evm/raw/logs (filter events) → 1 CU [L1] POST /evm/reserves (pool snapshot) → 80 CU [L3] POST /evm/prices/spot/crypto/ohlc (crypto OHLC) → 80 CU [L4] POST /evm/prices/spot/fiat/vwap (fiat benchmark) → 100 CU [L5] POST /evm/tvl (pool TVL USD) → 200 CU [L6] POST /evm/arb/opportunities (arb opportunities) → 1000 CU [L8] Total: 1462 CU ``` ## See Also * [Dataset index](/data-catalog/evm/dataset-index) — Dataset IDs and `blockdb_evm` table names * [Pricing Plans](/pricing/home) - Compare API, WSS, and Bulk Delivery options * [Usage Endpoint](/api-reference/account-and-usage/usage) - Track your CU consumption * [Contact Support](/troubleshooting/raising-a-support-ticket) - Billing and account questions # Error Codes Source: https://docs.blockdb.io/api-reference/overview/error-codes Complete reference of API error codes, meanings, and resolution strategies. ## Overview BlockDB API uses structured error envelopes with consistent codes, HTTP status, retry guidance, and links back to the docs. Use `hint`, `severity`, and `retryable` to decide whether to fix the request or retry later. ## Error Response Format All error responses follow this structure (fields may vary by code): ```json Error theme={null} { "error": { "code": "ERROR_CODE", "http_status": 400, "message": "Human-readable error message.", "hint": "Actionable guidance.", "severity": "error | warning | critical", "retryable": false, "details": {}, "docs_url": "https://docs.blockdb.io/api-reference/overview/error-codes" } } ``` ## Common Error Codes ### Authentication & Authorization | Code | HTTP Status | Description | Resolution | | ----------------------- | ----------- | ------------------------------------------ | ---------------------------------------------------------------------------------------------- | | `BAD_REQUEST` | 400 | Invalid or missing parameters | Fix fields listed in `details.invalid_parameters`; use ISO-8601 timestamps and valid chain IDs | | `UNAUTHORIZED` | 401 | Invalid or missing API key | Send `Authorization: Bearer `; regenerate key if compromised | | `FORBIDDEN` | 403 | API key lacks permission for this endpoint | Upgrade plan or request access (`required_plan` in `details`) | | `NOT_FOUND` | 404 | Resource does not exist | Verify endpoint path and parameters | | `PAYLOAD_TOO_LARGE` | 413 | Response would exceed size limits | Lower `limit`, narrow block/time window, or reduce filters | | `RATE_LIMIT_EXCEEDED` | 429 | Request rate exceeded | Apply client throttling/backoff and honor `retry_after_seconds` | | `INTERNAL_SERVER_ERROR` | 500 | Unexpected server error | Safe to retry; include `incident_id` in support tickets | ## Error Code Reference by Category * `UNAUTHORIZED` (401) * `FORBIDDEN` (403) * `BAD_REQUEST` (400) * `NOT_FOUND` (404) * `RATE_LIMIT_EXCEEDED` (429) * `PAYLOAD_TOO_LARGE` (413) * `INTERNAL_SERVER_ERROR` (500) ## See Also * [Dataset index](/data-catalog/evm/dataset-index) — Dataset-scoped access and table names * [Troubleshooting: API Error Codes](/troubleshooting/error-codes/api/home) - Detailed troubleshooting guide * [Authorization](/api-reference/overview/authorization) - Authentication errors * [Rate Limiting](/api-reference/overview/rate-limiting) - Rate limit handling * [Raising a Support Ticket](/troubleshooting/raising-a-support-ticket) - Get help with errors # Introduction Source: https://docs.blockdb.io/api-reference/overview/home Overview of the BlockDB Historic REST API — authentication, pagination, compute units, and onboarding for EVM blockchain data. ## Video walkthrough **BlockDB Free Account, API Key & First Query in 2 Minutes** — sign up, create a key, and run your first query: