Skip to main content

query

Querying subcommands for retrieving blockchain state and information. The query system provides comprehensive access to all blockchain data including account balances, validator information, governance proposals, Bitcoin staking data, and Babylon-specific protocol state.

Overview

The query command group serves as the primary interface for reading blockchain state, offering access to over 30 modules covering everything from basic account information to advanced Bitcoin staking and finality provider data. All queries are read-only operations that don't modify blockchain state.

babylond query [module] [subcommand] [flags]

Alias: q (shorthand for query)

Module Categories

Core Cosmos Modules

ModuleDescriptionKey Queries
authAccount authentication and managementaccounts, account info, module accounts
bankToken balances and transfersbalances, total supply, denomination metadata
stakingValidator bonding and delegationsvalidators, delegations, staking pool
distributionStaking reward distributionrewards, commission, community pool
govGovernance proposals and votingproposals, votes, governance parameters
slashingValidator penalty trackingsigning info, slashing parameters

Babylon-Specific Modules

ModuleDescriptionKey Queries
btcstakingBitcoin staking delegationsBTC delegations, finality providers, parameters
checkpointingBabylon checkpointing systemcheckpoints by epoch, checkpoint lists
finalityFinality provider operationsfinality votes, provider info, signing data
btclightclientBitcoin light clientBitcoin headers, main chain, tip information
btccheckpointBitcoin checkpoint submissionsepoch submissions, BTC height mappings
epochingEpoch-based operationsepoch info, validators, pending messages
incentiveReward and incentive systemBTC staking rewards, delegation rewards
zoneconciergeConsumer chain coordinationchain info, finalized states

IBC and Cross-Chain

ModuleDescriptionKey Queries
ibcInter-blockchain communicationchannels, clients, connections
ibc-transferIBC token transfersdenomination traces, escrow addresses
ibc-feeIBC relayer incentivizationpacket fees, relayer payees
ibc-wasmIBC WebAssembly contractscontract code, checksums

Infrastructure Modules

ModuleDescriptionKey Queries
authzAuthorization grantsgrants by granter/grantee
feegrantFee payment grantsfee grants, allowances
evidenceByzantine behavior evidencesubmitted evidence
circuitCircuit breaker functionalitydisabled messages, permissions
consensusConsensus parametersconsensus params, validator info
mintToken inflation and mintinginflation rate, annual provisions
paramsProtocol parametersmodule parameters
upgradeProtocol upgradesupgrade plans, module versions
wasmWebAssembly contractscontract state, code info

Block and Transaction Queries

CommandDescriptionUse Case
blockQuery specific blocksBlock inspection, debugging
block-resultsQuery block execution resultsTransaction outcomes, events
blocksSearch blocks by eventsBlock discovery, monitoring
txQuery specific transactionsTransaction verification
txsSearch transactions by eventsTransaction history, analysis
wait-txWait for transaction inclusionTransaction confirmation
comet-validator-setQuery validator setConsensus monitoring

Global Flags

FlagTypeDefaultDescription
--chain-idstringThe network chain ID
--homestring~/.babylondDirectory for config and data
--log_formatstringplainThe logging format (json|plain)
--log_levelstringinfoThe logging level
--log_no_colorDisable colored logs
--tracePrint full stack trace on errors

Common Query Patterns

Account and Balance Queries

Account information
# Check account balance
babylond query bank balances babylon1abc123...

# Get specific denomination balance
babylond query bank balance babylon1abc123... ubbn

# Check account details
babylond query auth account babylon1abc123...

# Get total supply
babylond query bank total-supply

Validator and Staking Queries

Validator information
# List all validators
babylond query staking validators

# Get specific validator info
babylond query staking validator babylonvaloper1abc123...

# Check delegations to a validator
babylond query staking delegations-to babylonvaloper1abc123...

# Get delegator's delegations
babylond query staking delegations babylon1abc123...

# Check staking pool
babylond query staking pool

Bitcoin Staking Queries

Bitcoin staking information
# Get all finality providers
babylond query btcstaking finality-providers

# Check specific finality provider
babylond query btcstaking finality-provider <btc-pk-hex>

# Get BTC delegations by status
babylond query btcstaking btc-delegations --status active

# Check BTC staking parameters
babylond query btcstaking params

Finality and Checkpointing

Finality system queries
# Get finality providers at height
babylond query finality finality-providers-at-height 1000

# Check finality votes at height
babylond query finality votes-at-height 1000

# Get checkpoint for epoch
babylond query checkpointing raw-checkpoint 10

# Check epoch information
babylond query epoching epoch

Governance Queries

Governance information
# List active proposals
babylond query gov proposals --status voting_period

# Get specific proposal
babylond query gov proposal 1

# Check proposal votes
babylond query gov votes 1

# Get governance parameters
babylond query gov params