feat: add esplora-compatible block and transaction endpoints#7
Merged
elsirion merged 1 commit intoelsirion:masterfrom Jan 14, 2026
Merged
Conversation
3db5659 to
8fafba8
Compare
8fafba8 to
92d9ea5
Compare
Add new esplora API endpoints:
- GET /api/block/{hash}/header - returns 80-byte block header as hex
- GET /api/tx/{txid}/merkle-proof - returns merkle proof in Electrum format
Other changes:
- Fix /api/block/{hash}/raw to return binary data instead of hex
- Add unit tests for compute_merkle_proof function
- Add minipool-test check to flake.nix for CI test execution
- Fix error handling when transaction not found in block
cc43eb7 to
5609007
Compare
elsirion
approved these changes
Jan 14, 2026
| proof | ||
| } | ||
|
|
||
| /// GET /api/tx/{txid}/merkle-proof - Get merkle proof in JSON format |
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
Primary fix: The
/api/block/{hash}/rawendpoint now correctly returns raw binary block data withContent-Type: application/octet-streaminstead of hex-encoded text. This matches the real esplora API behavior (blockstream.info/mempool.space).Additional endpoints added:
/api/block/{hash}/header- returns 80-byte block header as hex/api/tx/{txid}/merkle-proof- returns JSON withblock_height,merklearray, andposDevelopment tooling:
justfilewith common dev commands (just run,just test,just build, etc.)scripts/run-local.sh- run minipool with Bitcoin Core cookie auth from~/.bitcoinscripts/test-endpoints.sh- comprehensive test suite comparing against blockstream.infoOther changes:
justto devShellTest plan
All 16 endpoint tests pass against blockstream.info:
Run tests with a single command (requires local Bitcoin Core with cookie auth):
Or manually in separate terminals: