Skip to content

[proto] add block query APIs#85

Merged
liran-funaro merged 1 commit intohyperledger:mainfrom
cendhu:expose-ledger-api
Feb 19, 2026
Merged

[proto] add block query APIs#85
liran-funaro merged 1 commit intohyperledger:mainfrom
cendhu:expose-ledger-api

Conversation

@cendhu
Copy link
Contributor

@cendhu cendhu commented Feb 19, 2026

Type of change

  • New feature

Description

This commits adds the following four gRPC APIs

    rpc GetBlockchainInfo(google.protobuf.Empty) returns (common.BlockchainInfo);
    rpc GetBlockByNumber(BlockNumber) returns (common.Block);
    rpc GetBlockByTxID(TxID) returns (common.Block);
    rpc GetTxByID(TxID) returns (common.Envelope);

to be exposed by the sidecar to allow endorser/fsc to query block or tx envelope from the ledger store.

@cendhu cendhu requested a review from liran-funaro February 19, 2026 05:08
@cendhu cendhu changed the title [proto] add ledger query APIs [proto] add block query APIs Feb 19, 2026
This commits adds the following four gRPC APIs

    rpc GetBlockchainInfo(google.protobuf.Empty) returns (common.BlockchainInfo);
    rpc GetBlockByNumber(BlockNumber) returns (common.Block);
    rpc GetBlockByTxID(TxID) returns (common.Block);
    rpc GetTxByID(TxID) returns (common.Envelope);

to be exposed by the sidecar to allow endorser/fsc to query
block or tx envelope from the ledger store.

Signed-off-by: Senthilnathan <cendhu@gmail.com>
Comment on lines +20 to +22
rpc GetBlockByNumber(BlockNumber) returns (common.Block);
rpc GetBlockByTxID(TxID) returns (common.Block);
rpc GetTxByID(TxID) returns (common.Envelope);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest modifying these to support batches instead.

message BlockQuery {
    repeated uint64 number = 1;
}

message TxIDQuery {
    repeated string tx_id = 1;
}

Copy link
Contributor Author

@cendhu cendhu Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The block store query APIs are not efficient. Hence, I would keep this simple and just reflect existing API signatures in the block store. Then, we will have a limit on these calls. In general, these APIs should be used sparingly and @adecaro confirmed this too. Hence, not providing a repeated fields and then restricting the number of blocks/txs are intentional.

@liran-funaro liran-funaro merged commit 26c5a49 into hyperledger:main Feb 19, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants