Add --disable-output-confirmations flag#4498
Draft
utxo-detective wants to merge 1 commit into
Draft
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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:
Full /output endpoint simulation at 200 concurrent:
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:
Solution
When `--disable-output-confirmations` is set, `get_output_info` uses the pre-confirmations code path:
Default behavior is unchanged. This is an opt-in optimization for operators who prioritize API throughput over confirmations data.
Test plan