feat: add GET /v0/blockInfo/{blockHash} endpoint#170
Merged
DOBEN merged 1 commit intoConcordium:mainfrom Mar 10, 2026
Merged
Conversation
Contributor
Author
6 tasks
Add a new endpoint that returns block information for a given block hash. The response uses the existing BlockInfo type which already has a ToJSON instance, so the full block metadata is returned directly. Returns 404 if no block with the given hash exists. Returns 400 if the provided hash is malformed.
28d5c33 to
0c2e604
Compare
DOBEN
approved these changes
Mar 10, 2026
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.
Purpose
Adds a new
GET /v0/blockInfo/{blockHash}endpoint that returns metadata for a block identified by its hash.Motivation
Following up on #169 — wallet clients that need to query chain history currently require a direct gRPC connection to the node. A
blockInfoendpoint through the proxy allows fetching block metadata (height, baker, transaction count, timestamps, finalization status) via REST, without a gRPC client.Changes
src/Proxy.hs: New route/v0/blockInfo/#Text BlockInfoR GETand handler (~15 lines)src/Internationalization/Base.hs: NewEMMalformedBlockHasherror constructorsrc/Internationalization/En.hs: English translation for the new errorChangeLog.md: Entry under[unreleased]README.md: Endpoint listed + full response format documentationImplementation
Parses the block hash from the path using
readMaybe, callsgetBlockInfo (Given blockHash), and returns the result directly as JSON. TheBlockInfotype already has aToJSONinstance viaderiveJSON, so no manual field mapping is needed. Returns404if the block hash is not found,400if the hash is malformed.Checklist
hard-to-understand areas.
By submitting the contribution I accept the terms and conditions of the
Contributor License Agreement v1.0
link: https://developers.concordium.com/CLAs/Contributor-License-Agreement-v1.0.pdf
I accept the above linked CLA.