Skip to content

Add --disable-output-confirmations flag#4498

Draft
utxo-detective wants to merge 1 commit into
ordinals:masterfrom
utxo-detective:disable-output-confirmations
Draft

Add --disable-output-confirmations flag#4498
utxo-detective wants to merge 1 commit into
ordinals:masterfrom
utxo-detective:disable-output-confirmations

Conversation

@utxo-detective

@utxo-detective utxo-detective commented Mar 11, 2026

Copy link
Copy Markdown

Summary

Add a `--disable-output-confirmations` flag (and `ORD_DISABLE_OUTPUT_CONFIRMATIONS` env var) that switches the `/output` endpoint to a faster code path by skipping the confirmations lookup.

Problem

The `/output` endpoint currently makes up to 2 sequential Bitcoin Core RPC calls for every spent output:

  1. `gettxout(txid, vout, true)` — returns `None` for spent outputs
  2. `getrawtransaction(txid, true)` — verbose mode to get `confirmations`

The verbose `getrawtransaction` is more expensive than non-verbose because bitcoind must look up the block, compute confirmations from current chain height, and serialize a full decoded JSON response with all vins/vouts (~3.5x larger response).

Prior to the confirmations feature, the endpoint used a single non-verbose `getrawtransaction` (returns raw hex, deserialized client-side) plus a simple `gettxout` spent check.

Benchmarks

Tested against a local Bitcoin Core node (fully synced, block 940219) with 200 concurrent requests using 200 unique transactions:

Individual RPC call latency at 200 concurrent:

RPC Call p50 p99
`getrawtransaction` (non-verbose) 21ms 60ms
`getrawtransaction` (verbose) 27ms 75ms
`gettxout` 26ms 74ms

Full /output endpoint simulation at 200 concurrent:

Path Total p50 p99
Fast (non-verbose getrawtx + gettxout) 497ms 71ms 158ms
Current (gettxout + verbose getrawtx) 533ms 86ms 189ms

The fast path shows ~20% lower p50 and p99 latency at high concurrency. The improvement compounds in production where ord is also contending with index write locks and other concurrent operations.

Response size comparison for a typical transaction:

  • Non-verbose `getrawtransaction`: ~419 bytes
  • Verbose `getrawtransaction`: ~1,464 bytes (3.5x larger)

Solution

When `--disable-output-confirmations` is set, `get_output_info` uses the pre-confirmations code path:

  • Single non-verbose `getrawtransaction` call
  • Simple `is_output_spent` check via `gettxout`
  • `confirmations` field returns `0`

Default behavior is unchanged. This is an opt-in optimization for operators who prioritize API throughput over confirmations data.

Test plan

  • `/output` returns correct data with flag enabled (all fields except confirmations)
  • `/output` returns confirmations when flag is not set (default unchanged)
  • Flag works via CLI (`--disable-output-confirmations`) and env var (`ORD_DISABLE_OUTPUT_CONFIRMATIONS=1`)

Add a flag to skip the confirmations lookup on the /output endpoint,
significantly reducing Bitcoin Core RPC overhead per request.

The /output endpoint currently makes up to 2 sequential RPC calls for
every spent output: first gettxout (returns None for spent), then a
verbose getrawtransaction to get confirmations. The verbose call is
substantially more expensive than a raw getrawtransaction because
bitcoind must look up the block, compute confirmations from chain
height, and serialize a full decoded JSON response.

With --disable-output-confirmations, the endpoint uses a single
non-verbose getrawtransaction call plus a simple gettxout spent check,
matching the behavior prior to the confirmations feature. The
confirmations field returns 0 when disabled.

This is useful for API servers that do not need confirmations data and
prioritize throughput. The flag can also be set via the
ORD_DISABLE_OUTPUT_CONFIRMATIONS environment variable.
@utxo-detective utxo-detective marked this pull request as draft March 11, 2026 04:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant