Calling tx/:txid and /block-height/:height "in sync" based on bitcoind zmq notifications

Open
#458 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript
Domain
api, backend

Research direction

Start with the tx/:txid and /block-height/:height REST handlers and the bitcoind zmqpubhashtx/zmqpubhashblock notification flow described in the issue. Reproduce the regtest timing race and trace when indexing completes; done means requests triggered by these notifications no longer fail with 404 before the resources are available.

Written by the indexing model from the issue text.

Description

I'm running regtest scenarios where my code is calling my local esplora backend REST api based on bitcoind zmq notifications with zmqpubhashtx and zmqpubhashblock. My issue is that I call these two endpoints (tx/:txid and /block-height/:height) before esplora backend actually index them, which is causing errors:

INFO - handle GET /tx/8332bc9fe058113cae99b31f5472a71a757cc3cf6710ba7b2c3ca0586219333f
WARN - HttpError(404, "Transaction not found")
INFO - handle GET /block-height/106
WARN - HttpError(404, "Block not found")

Is there a way to call this endpoints only when these resources are available ?

Dominant language
JavaScript
Stars
1.3k
Forks
527
Avg merge
2d 5h
Merged PRs (30d)
4

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Blockstream/esplora

All issues in Blockstream/esplora

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.