What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

bitquery-go is a third-party Go SDK for sending GraphQL requests to Bitquery and subscribing to V2 WebSocket streams. Its main production advantage is that it makes the API choice explicit: V1, V2 over HTTPS, and V2 subscriptions use separate clients. It does not translate a V1 query into V2 or switch endpoints for you. Start with the client that matches your GraphQL schema and workload, then validate the chain, fields, region, and plan limits against Bitquery’s current documentation.

What bitquery-go does—and what “production-minded” means

The package is distributed as github.com/tigusigalpa/bitquery-go. Its documentation lists Go 1.21 or newer and an MIT license, and describes token providers, contexts, timeouts, retries, rate limiting, typed errors, and examples. These are documented capabilities, not evidence of independent reliability testing, a security audit, an SLA, or performance benchmarks.

Bitquery provides blockchain data through GraphQL APIs. With this SDK, a Go application can make request/response queries over HTTPS or maintain a V2 WebSocket subscription for live data. The SDK is not described as an official Bitquery SDK. Check the package documentation for its current API and the Bitquery documentation for current schemas and coverage.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose V1, V2 HTTPS, or V2 WebSockets

Pick an API contract before writing the query. V1 and V2 have different schemas, so changing the client alone does not migrate a GraphQL document. Bitquery describes V2 as supporting both historical and real-time data, with availability dependent on the chain.

Client choice Use it for Important constraint
V1 HTTPS A historical V1 GraphQL document that your application deliberately retains. The package says V1 remains for legacy coverage, while naming Ethereum, BSC, Matic/Polygon, and Tron V1 usage as deprecated. Do not assume its datasets or fields map directly to V2.
V2 HTTPS Request/response queries when the current V2 schema supports the needed chain and data. Check the exact fields and chain in the live schema and endpoint documentation; V2 is not a drop-in replacement for every V1 dataset.
V2 WebSocket subscription A persistent stream for a workload that needs live updates. This is a separate opt-in subscription client, not an automatic upgrade of HTTPS calls. Plan its lifecycle, cancellation, reconnects, buffering, and monitoring.

Bitquery’s endpoint guide lists regional V1 and V2 endpoints for Europe, Asia, and the United States, and recommends choosing one close to the application’s deployment region: “For optimal performance, use the endpoint closest to your application’s deployment region.” The V2 chain tables vary by region. Confirm that the endpoint you intend to use supports your chain and query before rollout: Bitquery endpoint documentation.

The documentation homepage describes 40+ networks across V1 and V2. That total is not a promise that every network is available on both API versions or every regional endpoint.

Install the module and make a minimal authenticated request

Install the module with Go modules:

go get github.com/tigusigalpa/bitquery-go

The package documentation describes static-token and client-credentials token providers. For a minimal setup, read a pre-minted token from the process environment rather than committing it to source code. The example below illustrates the setup pattern; check the package documentation for the exact constructor and query APIs for the version you install.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
token := os.Getenv("BITQUERY_TOKEN")
if token == "" {
    return errors.New("BITQUERY_TOKEN is required")
}

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()

// Create the appropriate V1 or V2 HTTPS client using the SDK's
// documented token provider, then execute a query with ctx.

The SDK documentation says HTTPS requests use Authorization: Bearer <token>. Bitquery’s platform overview discusses an older X-API-KEY mechanism, while the SDK describes OAuth bearer tokens. These are not interchangeable descriptions of one wire format. Use Bitquery’s current authentication guidance for account and token setup; do not infer the present SDK flow from the historical platform page: Bitquery platform overview.

For WebSockets, Bitquery’s documented flow places an OAuth token in a ?token= URL query parameter. The package says it handles this internally and redacts the token in its own errors and logger output. Keep tokens and OAuth secrets in environment configuration or a secret store. Built-in redaction is not a guarantee that custom loggers, proxies, or application logs cannot expose credentials.

Configure request behavior for your application

Set deadlines and propagate cancellation

The package documents timeout configuration and says each request and reconnect follows the supplied context.Context. Set an explicit context deadline that fits your application’s latency budget, and pass cancellation through the full call path so shutdown or a caller timeout can stop in-flight work.

Understand which operations can be retried

The documented default is up to four attempts, with approximately five-second exponential backoff, a sixty-second cap, jitter, and Retry-After taking precedence. The package describes retries for transient network errors, HTTP 429 responses, temporary 5xx errors, and documented shared-compute blocks. These are SDK-documented defaults; confirm them in the package version you deploy.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Automatic replay is limited to reads. Mutations and HTTP subscriptions are not automatically replayed. If your application retries an operation itself, first ensure repeating it is safe for that operation’s semantics.

Bound request rate and concurrency

A configurable rate limiter is available, but a sample setting such as 30 requests per minute is illustrative configuration, not a Bitquery quota. The SDK documentation says it does not fan out or parallelize heavy queries. Set worker limits in your application and stay within the concurrency allowance for your Bitquery plan. Uncontrolled fan-out can increase resource consumption and make failures harder to contain.

Handle errors by category

The package describes typed categories for plan entitlement, rate limit, server, strict GraphQL, and subscription errors. Use the category to guide recovery rather than treating every failure as transient: inspect retry-after information for rate limits, and do not retry plan entitlement failures as if they were temporary network problems.

Preserve large numeric values

The package says raw response data is available as json.RawMessage and helper decoding uses json.Number. This avoids silently converting large integers or token amounts to float64, which can lose precision. Keep these values in a precision-preserving representation through decoding and downstream calculations.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Validate the schema, endpoint, and plan before rollout

  1. Confirm the API version. Identify whether the document targets V1 or V2; do not swap clients and assume the query will migrate.
  2. Check chain and fields. Verify the specific dataset and fields in Bitquery’s current schema for the selected version.
  3. Select the regional endpoint. Use the endpoint guide to check regional chain coverage, and choose an endpoint near the deployment region where it supports the required data.
  4. Review service limits. Bitquery describes credit-based billing and resource-based query-point calculation. Costs vary with resource use, so check current plan limits and pricing rather than relying on stale numeric assumptions. Avoid unnecessary query fan-out.
  5. Exercise failure paths. Validate cancellation, deadline handling, rate-limit responses, entitlement errors, and stream shutdown behavior in your own application environment. SDK documentation alone does not establish application-specific production readiness.

Bitquery’s endpoint guide is at https://docs.bitquery.io/docs/intro/endpoints/; for WebSockets, it says to use the corresponding endpoint with wss in place of https. Because endpoint tables, schemas, chain coverage, package releases, and plan terms can change, verify them against the current documentation and the package version you deploy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.