Expose chainwork in block API responses

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

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
58/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
javascript
Domain
api, backend

Research direction

Trace the implementation of the /block/:hash endpoint and how its block data is obtained from Bitcoin Core. Confirm where the existing response is assembled and how chainwork is represented by the upstream getblock RPC. Done means block responses include a chainwork field while retaining the current response fields and behavior.

Written by the indexing model from the issue text.

Description

Bitcoin Core exposes the cumulative chainwork for each block via the getblock RPC. This value is the canonical measure used to compare competing chains and determine the active chain.

It would be useful if Esplora included a chainwork field in /block/:hash responses. This would allow clients to compare competing branches, analyze reorgs, and display cumulative proof of work without having to recompute it from every block's bits value.

Since chainwork is already maintained by Bitcoin Core, this would be an additive, backward-compatible API enhancement.

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.