DEV.co
Open-Source Databases · OdyseeTeam

chainquery

Chainquery is a Go-based indexer that parses LBRY blockchain data into a MySQL database, enabling fast SQL queries of blocks, transactions, addresses, and claims without RPC traversal. It syncs with LBRY full nodes (lbcd or lbrycrd), handles chain reorganizations automatically, and exposes a public read-only SQL API.

Source: GitHub — github.com/OdyseeTeam/chainquery
2.2k
GitHub stars
36
Forks
Go
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
RepositoryOdyseeTeam/chainquery
OwnerOdyseeTeam
Primary languageGo
LicenseMIT — OSI-approved
Stars2.2k
Forks36
Open issues41
Latest releasev2.6.0 (2026-06-12)
Last updated2026-06-12
Sourcehttps://github.com/OdyseeTeam/chainquery

What chainquery is

Single-binary daemon (chainquery serve) that ingests blocks from a LBRY full node via JSON-RPC, processes transactions in parallel with dependency ordering and retry logic, maintains MySQL schema consistency across reorgs (up to depth 100), and runs scheduled jobs to compute derived claim/address data. Exposes REST API with public SQL endpoint, address summaries, and Prometheus metrics.

Quickstart

Get the chainquery source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/OdyseeTeam/chainquery.gitcd chainquery# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

LBRY Ecosystem Data Infrastructure

Organizations building services on LBRY (content platforms, analytics, wallets) need indexed blockchain data. Chainquery provides the canonical indexing layer with pre-computed claim state, address balances, and transaction values.

Real-Time Blockchain Monitoring & Webhooks

Applications requiring live notification of new blocks, claims, or payments can subscribe via webhooks, Sockety events, or Slack integration, eliminating the need to poll chain RPC directly.

SQL-Based Blockchain Analytics

Teams performing historical analysis, financial reporting, or claim auditing benefit from the public read-only SQL API with configurable query timeouts, avoiding custom blockchain parsers.

Implementation considerations

  • Requires a running LBRY full node (lbcd or lbrycrd) with txindex enabled and RPC credentials matched to chainquery config.
  • MySQL 8+ must allow stored functions (log_bin_trust_function_creators = 1); initialize schema from db/chainquery_schema.sql and manage schema upgrades via the built-in upgrade manager.
  • Transactions within a block retry up to 1000 times on dependency failures; set maxparalleltxprocessing to tune parallelism (default NumCPU); monitor job_status and application_status tables.
  • API-key-protected endpoints (/process, /sync/*) are disabled by default (apikeys empty); configure if external callers need reprocessing or resyncing.
  • Configure notification endpoints (Sockety, webhooks, Slack) before production to avoid missing events; review maxsqlapitimeout and MAX_EXECUTION_TIME for SQL endpoint query limits.

When to avoid it — and what to weigh

  • Multi-Blockchain Support Required — Chainquery is LBRY-specific. Projects needing Ethereum, Bitcoin, or other chains should evaluate chain-agnostic indexers (e.g., The Graph, Subgraph) or blockchain-native solutions.
  • Write-Heavy API Workloads — The public SQL endpoint is read-only by design. Applications requiring write access must authenticate via separate DSN and bypass the HTTP API, complicating deployment.
  • Minimal Operational Overhead — Chainquery requires a dedicated MySQL instance, a LBRY full node, Go 1.26+, and careful configuration (DSN, RPC auth, job scheduling). Teams lacking DevOps resources should consider managed indexing services if available.
  • High Availability / Horizontal Scaling — The daemon is single-threaded across blocks (by design, using BlockLock) and maintains strict ordering. Scaling to multiple instances requires external coordination; not architected for multi-node failover.

License & commercial use

MIT License. Permissive open-source license allowing commercial use, modification, and distribution with minimal restrictions (retain license notice).

MIT is a standard permissive OSI-approved license explicitly permitting commercial use, including selling products or services built on Chainquery. No license fee, royalty, or attribution beyond copyright notice required. Verify you comply with any dependencies' licenses (SQLBoiler, Go standard library, MySQL drivers).

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityHigh
DEV.co fitGood
Assessment confidenceHigh
Security considerations

Chainquery exposes a public read-only SQL endpoint; implement rate-limiting, network segmentation, and query timeouts to prevent abuse. RPC credentials (lbycrdurl) should be stored securely (environment variables, secrets manager), not in config files. API-key authentication for reprocessing endpoints uses string comparison; rotate keys regularly. No mention of input validation/escaping for SQL queries; review prepared statement usage. Ensure MySQL user permissions follow least-privilege (read for API, write for daemon only).

Alternatives to consider

The Graph (Subgraphs)

Multi-chain subgraph indexing with GraphQL API and hosted/decentralized options; requires learning AssemblyScript but eliminates custom database operations. Best if supporting multiple blockchains.

Alchemy Enhanced APIs / Infura Insights

Managed blockchain data APIs (though Ethereum/Polygon/Solana focused); no self-hosting overhead. Not suitable for LBRY but easier for other chains if that becomes priority.

Custom JSON-RPC Parser + PostgreSQL

Build lightweight indexer in-house using chain's native RPC; avoids third-party dependencies but requires engineering effort. Viable for teams with LBRY-only scope and high customization needs.

Software development agency

Build on chainquery with DEV.co software developers

Chainquery provides production-ready schema and APIs to index and query LBRY data. Evaluate our DevOps and API development services to architect your deployment.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

chainquery FAQ

Do I need to run my own LBRY full node, or can Chainquery connect to a public node?
You must run or access a full node; chainquery connects over JSON-RPC (default rpc://lbry:lbry@localhost:9245). Public LBRY nodes may rate-limit or throttle RPC; for production, operate your own lbcd or lbrycrd with txindex=1.
What happens if the blockchain reorgs while Chainquery is running?
Chainquery detects reorgs by comparing stored previous-block hash against the chain, recursively deletes diverged blocks (depth up to 100), logs reorg depth, and reprocesses from the divergence height. Automatic; no manual intervention needed unless reorg exceeds depth 100.
Can I use the public SQL API for production analytics without authentication?
Yes, but with caveats: queries have configurable timeout (maxsqlapitimeout) and injected MAX_EXECUTION_TIME. Treat as a read-replica API with potential latency. For high-volume or critical workloads, use your own MySQL DSN and bypass the HTTP endpoint.
How do I scale Chainquery to handle high query load?
The daemon uses a single BlockLock to serialize block processing; you cannot run multiple daemons on the same database. Mitigation: operate multiple read-only MySQL replicas (using apimysqldsn DSN) and load-balance the API server across instances. Daemon runs on primary; API servers on replicas.

Custom software development services

Adopting chainquery is usually one piece of a larger software development effort. As a software development agency, DEV.co provides software development services and web development expertise — pairing senior software developers and web developers with your team to design, build, and operate open-source databases software in production.

Need LBRY blockchain indexing for your platform?

Chainquery provides production-ready schema and APIs to index and query LBRY data. Evaluate our DevOps and API development services to architect your deployment.