BAC-L2-COSMOS-109Cosmos SDK
Queries, gRPC and indexing
Exposing state to the outside: what should be directly queryable, and what belongs in an off-chain indexer.
- Level
- L2 — Appchain developer
- Duration
- 3 h
- Track
- Cosmos SDK
- Maintainer
- Cosmos Lead Architect
Learning objectives
- 01Define a query service and expose it
- 02Paginate a large response
- 03Decide what belongs on-chain and what belongs to the indexer
Guided lab
Expose paginated queries over the registry and consume them from an external client.
Independent lab
Build an off-chain indexer fed by the chain's events.
Security angle
An unpaginated query on a public node: one call, one outage.
Assessment
Query service successfully consumed by a peer's client.
