IntersectMBO / IntersectMBO/ouroboros-consensus

[FEAT] - Add Functionality to Query Full Block Details by Hash

Open
#1,481 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
67
Forks
43
Avg merge
5d 13h
Merged PRs (30d)
43

Description

**Internal/External**
*Internal*

**Describe the feature you'd like**
Provide a mechanism, accessible via Node-to-Client to query the Cardano node for detailed information about a specific block using its hash.

**Motivation:**

Currently, developers and builders (such as those behind cardanoscan.io, typhonwallet.io, and potentially DEXs) desire a more direct way to retrieve block data from the node than relying on tools like db-sync.

This functionality would mirror capabilities found in other blockchains, such as Bitcoin's `getblock` RPC call, making development and block exploration more straightforward.

The need exists to query both historical blocks and the current chain tip.

**Desired Information (Output):**

Given a block hash, the query should return comprehensive block details, including (but not limited to):

Transactions within the block
Slot number
Previous block hash
Block depth (confirmation count)
Block size

**Previous discussions:**

@jasagredo suggested that the most viable node-based solution appears to be exposing the existing BlockFetch protocol (currently used for Node-to-Node communication - NTN) through the Node-to-Client (NTC) interface

Rationale: BlockFetch already interacts with the immutable database (which acts as the necessary index) to retrieve blocks. Exposing it via NTC would allow trusted local clients to request specific blocks directly, potentially simplifying implementation compared to NTN which involves inter-node trust assumptions.

This would be complemented by native RPC implementation described in https://github.com/IntersectMBO/cardano-node/issues/6185 and also through API and CLI

**Additional context / screenshots**

- https://developer.bitcoin.org/reference/rpc/getblock.html|

- Originally requested by https://github.com/IntersectMBO/cardano-node/issues/6121

Contributor guide

Open the contributing guide

Research direction

Review the existing BlockFetch protocol and the Node-to-Client interface, then compare the requested hash lookup with the linked RPC, API, and CLI work. Done means a node-accessible query can return transactions, slot, previous hash, depth, and size for historical blocks and the chain tip.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
blockchain, distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.