Skip to content

Add opt-in streams Bitcoin indexer support to por-indexer - #5175

Draft
cawthorne wants to merge 8 commits into
mainfrom
por-indexer-streams-btc-indexer
Draft

Add opt-in streams Bitcoin indexer support to por-indexer#5175
cawthorne wants to merge 8 commits into
mainfrom
por-indexer-streams-btc-indexer

Conversation

@cawthorne

@cawthorne cawthorne commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add an opt-in streams/BCY Bitcoin indexer path to por-indexer via UTXO queries (same Electrs-compatible REST API as dlc-cbtc-por)
  • Default behaviour unchanged: Bitcoin still uses the existing bitcoin-por-indexer HTTP service via BITCOIN_*_POR_INDEXER_URL
  • Opt-in per NOP: set BITCOIN_*_USE_STREAMS_INDEXER=true and BITCOIN_*_RPC_URL on the por-indexer deployment to switch Bitcoin balances to the streams indexer
  • Preserves minConfirmations filtering on the streams path (UTXO block height + pending-spend adjustment)
  • No proof-of-reserves jobspec changes — jobs keep indexer: por_indexer

Env vars

Variable Purpose
BITCOIN_*_POR_INDEXER_URL Default path — existing bitcoin-por-indexer HTTP (unchanged)
BITCOIN_*_USE_STREAMS_INDEXER Set true to enable streams path (default false)
BITCOIN_*_RPC_URL Streams/BCY indexer base URL (required when streams flag is true)

Test plan

  • yarn jest packages/sources/por-indexer (14 tests passing)
  • Default-path integration tests (legacy bitcoin-por-indexer HTTP mocks)
  • Opt-in streams integration tests (adapter-streams.test.ts)
  • Unit tests for confirmation math and UTXO filtering
  • Deploy updated por-indexer EA to staging
  • Canary one production NOP with BITCOIN_MAINNET_USE_STREAMS_INDEXER=true + BITCOIN_MAINNET_RPC_URL
  • Compare reserves output against current production before wider rollout

…xer.

Query UTXOs directly via the Electrs-compatible streams Bitcoin indexer while preserving minConfirmations, so proof-of-reserves jobs can keep using por_indexer unchanged.
@changeset-bot

changeset-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d0d0392

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@chainlink/por-indexer-adapter Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

cawthorne added 5 commits July 7, 2026 18:01
Bump external-adapter-framework to 2.17.1, apply Prettier formatting, and strip response meta from integration snapshots so CI matches consistently.
Keep yarn install output in sync with the lockfile change to 2.17.1.
Regenerate the lockfile artifact on Node 22/Linux so CI dependency verification passes.
Keep bitcoin-por-indexer HTTP as the default path and enable BCY UTXO queries only when BITCOIN_*_USE_STREAMS_INDEXER and BITCOIN_*_RPC_URL are set, so NOPs can upgrade without a jobspec change.
@cawthorne cawthorne changed the title Replace por-indexer backend with streams Bitcoin indexer Add opt-in streams Bitcoin indexer support to por-indexer Jul 10, 2026
Limit streams indexer opt-in to Bitcoin mainnet, simplify BTC reserve logic, drop unit tests and unused helpers, and keep framework at 2.16.1.
Filter pending spend inputs by source tx confirmation depth via /tx/{txid}/status, cap streams address batch concurrency, and add unit tests for calculateReserves.
@cawthorne
cawthorne marked this pull request as draft July 10, 2026 17:51
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