Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HIP-21 Network info query #3098

Closed
steven-sheehy opened this issue Jan 3, 2022 · 0 comments · Fixed by #3141
Closed

HIP-21 Network info query #3098

steven-sheehy opened this issue Jan 3, 2022 · 0 comments · Fixed by #3141
Assignees
Labels
enhancement Type: New feature grpc Area: GRPC API P2
Milestone

Comments

@steven-sheehy
Copy link
Member

steven-sheehy commented Jan 3, 2022

Problem

HIP-21 details a free network info query be added to the mirror nodes for use by the SDKs. We should target initially adding a gRPC API to the mirror node since SDKs don't currently support connecting to the REST API.

Solution

See the abandoned services proto PR for inspiration.

  • Create a design document
  • Create a network_service.proto both in mirror node repository and hedera-protobufs repository
message AddressBookQuery {
    FileID file_id = 1; // The ID of the address book file on the network. Can be either 0.0.101 or 0.0.102.
    int32 limit = 2; // The maximum number of node addresses to receive before stopping. If not set or set to zero it will return all node addresses in the database.
}

service NetworkService {
    rpc getNodes (AddressBookQuery) returns (stream NodeAddress);
}
  • Create a NetworkController that implements the proto
  • Create a NetworkServiceImpl with caching
  • Create an AddressBookRepository that finds the latest address book
  • Create an AddressBookEntryRepository
select * from address_book_entry
where node_id >= ? and consensus_timestamp = ?
order by node_id asc
limit 10;

Alternatives

Rejected since returning the full address book in one response would be too large. Current address book is 25K and growing.

/**
 * Response to a getNetworkInfo query.
 */
message NetworkInfoResponse {
    /**
     * The network <i>address book</i>, which includes not just the IP addresses of the network 
     * nodes, but also the the cryptographic keys they use to sign transactions and encrypt connections. Please 
     * see the <a href="https://hashgraph.github.io/hedera-protobufs/#proto.NodeAddress"><tt>NodeAddress</tt></a>
     * type for more details.
     */
    NodeAddressBook node_address_book = 1;
}

/**
 * Queries associated with the network as a whole.
 */
service NetworkService {
    /**
     * Retrieves free metadata about the network, most importantly its <i>address book</i>. 
     */
    rpc getNetworkInfo () returns (NetworkInfoResponse);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Type: New feature grpc Area: GRPC API P2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant