Indexer staking
(1) Rigorous notes and solutions for core algorithms and computing fundamentals broken down for deliberate practice with Anki. (2) A monorepo of libraries and CLI tools I use regularly as a software engineer.
npx -y skills add Unique-Divine/jiyuu --skill indexer-stakingAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 6 stars6 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Use when the user asks about the Nibiru indexer (Heart Monitor), staking GraphQL schema, GQLValidator, GQLDelegation, HeartMonitor, or querying staking data via GraphQL. Explains that staking is under query.staking, not root-level deprecated fields; rewards come from the chain (distribution), not the indexer; amounts are Int in base units (e.g. unibi).
SKILL.md
4.7 KB, as published. Nobody here has run it
Nibiru Indexer (Heart Monitor) — Staking
Use this skill when working with the Nibiru indexer / Heart Monitor GraphQL API or the staking part of the schema (validators, delegations, redelegations, unbondings, history).
Quick Facts
- Indexer = Heart Monitor = GraphQL API. Endpoints (path
/query): Mainnethttps://hm-graphql.nibiru.fi/query; testnethttps://hm-graphql.itn-2.nibiru.fi/query. Env is the hostname segment for the network: mainnet has no env (hosthm-graphql.nibiru.fi); testnet uses envitn-2(hosthm-graphql.itn-2.nibiru.fi). The playground uses the same host with path/graphql. - Canonical Path: Always use
query { staking { ... } }. Root-level fields are deprecated. - Bond denom: The staking token denomination is unibi — shorthand for micro NIBI (μ NIBI), where "u" comes from "μ" (mu).
- Amounts: Stored as Int in base units (unibi). Divide by 10^6 for
NIBI. - Shares: A delegator's proportional claim on a validator's pool; the shares-to-tokens rate changes with slashing (see Shares vs. Amount below).
- Valoper: Validator operator address (
nibivaloper1...). Validators have three Bech32 identities: accountnibi1..., operator (valoper), and consensusnibivalcons1...; usenibid debug addrto convert. Indexer/CLI staking use valoper. - Rewards: Not in the indexer. Use the chain’s distribution module via the Nibiru CLI:
nibid query distribution(e.g.rewards) andnibid tx distribution. - TS SDK: Use
HeartMonitorfrom@nibiruchain/nibijs.
Dependency Flow & Lineage
Data flows from the chain to the client in a specific pipeline. Understanding this prevents schema confusion:
- Chain State (Go): Source of truth. Staking module (
internal/cosmos-sdk) stores Shares for delegations. - Indexer Sync: The
nibi-go-hmserver queries the chain, calculates the token Balance, and persists it to the indexer DB. - GraphQL API: The API (
staking.graphqls) exposes these DB fields. This is why you seeamount(tokens) but usually notsharesin indexer delegations. - TS SDK: The client (
nibi-ts-sdk) generates types and query builders from the GraphQL schema.
Shares vs. Amount (Critical)
Shares are a delegator's proportional claim on a validator's pool; the shares-to-tokens rate changes with slashing.
- Indexer
Delegation.amountis a balance snapshot in tokens. It does not track shares. - Slashing/Compensation: Here compensation means reimbursing delegators after slashing or validator misbehavior (distinct from commission, the validator's share of rewards). You cannot derive shares from the indexer amount after a slash. For reproducible compensation math, you MUST query the chain directly (e.g.,
nibid q staking delegations-to) using a specific--height.
Rule of Thumb: Where to Query?
| Requirement | Preferred Source | Reason |
|---|---|---|
| Current delegator balances | Indexer | Fast, indexed, GraphQL support. |
| Historical staking actions | Indexer | staking { history } tracks events over time. |
| Rewards | Chain | Indexer does not track distribution module data. |
| Compensation / Slashing | Chain | Requires shares and height-specific snapshots. |
| Validator uptime/jailed status | Either | Indexer is fine unless absolute real-time is needed. |
Additional Resources
- Full Reference (reference.md):
- Canonical Query Shape & Deprecation
- TS SDK Internals & Query Builder
- Pagination & 1000-Row Limits
- Lineage & Chain Types (Go)
- CLI Mapping (nibid ↔ Indexer)
- Compensation & Migration Gotchas
- GraphQL Schema Types
- User type definition
- Order enums (ValidatorOrder, DelegationOrder, etc.)
- Example: list delegations for address X
- Upstream Repo File Pointers