# query (q)

Using the query command of the daemon, you can search all the module data listed on the chain.

{% hint style="info" %}
When using the command, you can substitute **`query`** to **`q`**.\
firmachaind **`query`** subcommands-> firmachaind **`q`** subcommands
{% endhint %}

## query authz

Querying commands for the authz module.

### `grants`

Query authorization grants for a granter-grantee pair. If msg-type-url is set, it will select grants only for that msg type.

***Usage***

```bash
firmachaind query authz grants <granter-addr> <grantee-addr>
```

***Example***

```bash
firmachaind query authz grants firma1thh.. firma1nss.. /cosmos.bank.v1beta1.MsgSend
```

## query bank

Querying commands for the bank module.

### `balances`

Query the total balance of an account or of a specific denomination.

***Usage***

```bash
firmachaind query bank balances <address>
```

***Example***

```bash
firmachaind query bank balances firma1e..y5a43qc
```

### `denom-metadata`

Query the client metadata for all the registered coin denominations

***Usage***

```bash
firmachaind query bank denom-metadata
```

### `total`

Query total supply of coins that are held by accounts in the chain.

***Usage***

```bash
firmachaind query bank total
```

## query block

Get verified data for a the block at given height.

***Usage***

```bash
firmachaind query block <height>
```

***Example***

```bash
firmachaind query block 100
```

## query contract

Querying commands for the contract module.

### `is-contract-owner`

Check Contract Owner by ownerAddress and fileHash

***Usage***

```bash
firmachaind query contract is-contract-owner <fileHash> <ownerAddress>
```

***Example***

```
firmachaind query contract is-contract-owner "fileHash" firma1e..y5a43qc
```

### `list-contract-file`

list all contractFile

***Usage***

```
firmachaind query contract list-contract-file
```

### `list-contract-log`

list all contractLog

***Usage***

```
firmachaind q contract list-contract-log
```

### `show-contract-file`

shows a contractFile by index.

***Usage***

```
firmachaind query contract show-contract-file <index>
```

***Example***

```
firmachaind query contract show-contract-file 1
```

### `show-contract-list-from-hash`

Get Contract from contract hash

***Usage***

```
firmachaind query contract show-contract-list-from-hash <contractHash>
```

***Example***

```
firmachaind query contract show-contract-list-from-hash "contractHash"
```

### `show-contract-log`

shows a contractLog

***Usage***

```
firmachaind query contract show-contract-log <id>
```

***Example***

```
firmachaind query contract show-contract-log 1
```

## query distribution

Querying commands for the distribution module.

### `commission`

Query validator commission rewards from delegators to that validator.

***Usage***

```
firmachaind query distribution commission <valoper_address>
```

***Example***

```
firmachaind query distribution commission firmavaloper..y2w72qk
```

### `community-pool`

Query all coins in the community pool which is under Governance control.

***Usage***

```
firmachaind q distribution community-pool
```

### `params`

Query distribution params.

***Usage***

```
firmachaind q distribution params
```

### `rewards`

Query all rewards earned by a delegator, optionally restrict to rewards from a single validator.

***Usage***

```
firmachaind query distribution rewards <delegate-address>
```

***Example***

```
firmachaind query distribution rewards firma1e..y5a43qc
```

By putting in the command provided in the above example, you can check the total amount of your reward. Furthermore, if you wish to check the amount of reward accrued from a particular Validator, you can add the validator-address at the back of the delegate-address as provided in the example below.

***Usage***

```
firmachaind query distribution rewards <delegate-address> <validator-address>
```

***Example***

```
firmachaind query distribution rewards firma1e..y5a43qc firmavaloper..y2w72qk..2qk
```

### `slashes`

Query all slashes of a validator for a given block range.

***Usage***

```
firmachaind query distribution slashes <validator-address> <start-height> <end-height>
```

***Example***

```
firmachaind query distribution slashes firmavaloper1epg..2qk 0 100
```

## query feegrant

Querying commands for the feegrant module.

### `grant`

Query details for a grant.

***Usage***

```
firmachaind query feegrant grant <granter> <grantee>
```

***Example***

```
firmachaind query feegrant grant firma1e..y5a43qc firma1n..65ux9u
```

### `grants-by-grantee`

Queries all the grants for a grantee address.

***Usage***

```
firmachaind query feegrant grants-by-grantee <grantee>
```

***Example***

```
firmachaind query feegrant grants-by-grantee firma1e..y5a43qc
```

### `grants-by-granter`

Queries all the grants issued for a granter address.

***Usage***

```
firmachaind query feegrant grants-by-granter <granter>
```

***Example***

```
firmachaind query feegrant grants-by-granter firma1n..65ux9u
```

## query gov

Querying commands for the governance module

### `deposit`

Query details for a single proposal deposit on a proposal by its identifier.

***Usage***

```
firmachaind query gov deposit <proposal-id> <depositer-address>
```

***Example***

```
firmachaind query gov deposit 1 firma1e..y5a43qc
```

### `deposits`

Query details for all deposits on a proposal. You can find the proposal-id by running "firmachaind query gov proposals".

***Usage***

```
firmachaind query gov deposits <proposal-id>
```

***Example***

```
firmachaind query gov deposits 1
```

### `param`

Query the all the parameters for the governance process.

***Usage***

```
firmachaind query gov param <param-type>
```

***Example***

```
firmachaind query gov param voting
firmachaind query gov param tallying
firmachaind query gov param deposit
```

### `params`

Query the all the parameters for all governance process.

***Usage***

```
firmachaind query gov params
```

### `proposal`

Query details for a proposal. You can find the proposal-id by running "firmachaind query gov proposals".

***Usage***

```
firmachaind query gov proposal <proposal-id>
```

***Example***

```
firmachaind query gov proposal 1
```

### `proposals`

Query for a all paginated proposals that match optional filters:

***Usage***

```
firmachaind query gov proposals
```

***Example***

```
firmachaind query gov proposals --depositor firma1e..y5a43qc
firmachaind query gov proposals --voter firma1e..y5a43qc
firmachaind query gov proposals --status (DepositPeriod|VotingPeriod|Passed|Rejected)
firmachaind query gov proposals --page=2 --limit=100
```

### `proposer`

Query which address proposed a proposal with a given ID.

***Usage***

```
firmachaind query gov proposer <proposal-id>
```

***Example***

```
firmachaind query gov proposer 1
```

### `tally`

Query tally of votes on a proposal. You can find the proposal-id by running "firmachaind query gov proposals".

***Usage***

```
firmachaind query gov tally <proposal-id>
```

### `vote`

Query details for a single vote on a proposal given its identifier.

***Usage***

```
firmachaind query gov vote <proposal-id> <voter-addr>
```

***Example***

```
firmachaind query gov vote 1 firma1e..y5a43qc
```

### `votes`

Query vote details for a single proposal by its identifier.

***Usage***

```
firmachaind query gov votes <proposal-id> <flag?>
```

***Example***

```
firmachaind query gov votes 1
firmachaind query gov votes 1 --page=2 --limit=100
```

## ibc-transfer

IBC fungible token transfer query subcommands

### `denom-hash`

Query the denom hash info from a given denom trace.

***Usage***

```
firmachaind query ibc-transfer denom-hash <trace>
```

***Example***

```
firmachaind query ibc-transfer denom-hash transfer/channel-0/(denom)
```

### `denom-trace`

Query the denom trace info from a given trace hash or ibc denom

***Usage***

```
firmachaind query ibc-transfer denom-trace <hash/denom>
```

***Example***

```
firmachaind query ibc-transfer denom-trace 27A6394C3F9FF9C9DCF5DFFADF9BB5FE9A37C7E92B006199894CF1824DF9AC7C
```

### `denom-traces`

Query the trace info for all token denominations

***Usage***

```
firmachaind query ibc-transfer denom-traces
```

### `escrow-address`

Get the escrow address for a channel.

***Usage***

```
firmachaind query ibc-transfer escrow-address <port> <channel-id>
```

***Example***

```
firmachaind query ibc-transfer escrow-address transfer channel-1
```

### `params`

Query the current ibc-transfer parameters

***Usage***

```
firmachaind query ibc-transfer params
```

## mint

Querying commands for the minting module.

### `annual-provisions`

Query the current minting annual provisions value.

***Usage***

```
firmachaind query mint annual-provisions
```

### `inflation`

Query the current minting inflation value

***Usage***

```
firmachaind query mint inflation
```

### `params`

Query the current minting parameters

***Usage***

```
firmachaind query mint params
```

## nft

Querying commands for the nft module

### `balance-of`

Query balanceOf

***Usage***

```
firmachaind query nft balance-of <ownerAddress>
```

### `list-nft-id-of-owner`

Query Nft ID List Of Owner

***Usage***

```
firmachaind query nft list-nft-id-of-owner <ownerAddress>
```

***Example***

```
firmachaind query nft list-nft-id-of-owner firma1e..y5a43qc
```

### `list-nft-item`

list all nftItem

***Usage***

```
firmachaind query nft list-nft-item
```

### `show-nft-item`

shows a nftItem

***Usage***

```
firmachaind query nft show-nft-item <id>
```

***Example***

```
firmachaind query nft show-nft-item 0
```

## params

Querying commands for the params module

### `subspace`

***Usage***

```
firmachaind query params subspace <subspace> <key>
```

***Example***

```
firmachaind query params subspace staking MaxValidators
```

## slashing

Querying commands for the slashing module

### `params`

Query genesis parameters for the slashing module.

***Usage***

```
firmachaind query slashing params
```

### `signing`

Use a validators' consensus public key to find the signing-info for that validator.

***Usage***

```
firmachaind query slashing signing-info <validator-conspub>
```

***Example***

```
firmachaind query slashing signing-info '{"@type":"/cosmos.crypto.ed25519.PubKey","key":"OauFcTKbN5Lx3fJL689cikXBqe+hcp6Y+x0rYUdR9Jk="}'
```

### `signing-infos`

signing infos of validators

***Usage***

```
firmachaind query slashing signing-infos
```

## staking

Querying commands for the staking module

### `delegation`

Query delegations for an individual delegator on an individual validator.

***Usage***

```
firmachaind query staking delegation <delegator-addr> <validator-addr>
```

***Example***

```
firmachaind query staking delegation firma1e..y5a43qc firmavaloper..y2w72qk
```

### `delegations`

Query delegations for an individual delegator on all validators.

***Usage***

```
firmachaind query staking delegations
```

***Example***

```
firmachaind query staking delegations firma1e..y5a43qc
```

### `delegations-to`

Query delegations on an individual validator.

***Usage***

```
firmachaind query staking delegations-to <validator-addr>
```

***Example***

```
firmachaind query staking delegations-to firmavaloper..y2w72qk
```

### `historical-info`

Query historical info at given height.

***Usage***

```
firmachaind query staking historical-info <height>
```

***Example***

```
firmachaind query staking historical-info 100
```

### `params`

Query values set as staking parameters.

***Usage***

```
firmachaind query staking params
```

### `pool`

Query values for amounts stored in the staking pool.

***Usage***

```
firmachaind query staking pool
```

### `redelegation`

Query a redelegation record for an individual delegator between a source and destination validator.

***Usage***

```
firmachaind query staking redelegation <delegator-addr> <src-validator-addr> <dst-validator-addr>
```

***Example***

```
firmachaind query staking redelegation firma1e..y5a43qc firmavaloper..y2w72qk firmavaloper..xy8ha9j
```

### `redelegations`

Query all redelegation records for an individual delegator.

***Usage***

```
firmachaind query staking redelegation <delegator-addr>
```

***Example***

```
firmachaind query staking redelegation firma1e..y5a43qc
```

### `redelegations-from`

Query delegations that are redelegating *from* a validator.

***Usage***

```
firmachaind query staking redelegations-from <validator-addr>
```

***Example***

```
firmachaind query staking redelegations-from firmavaloper..y2w72qk
```

### `unbonding-delegation`

Query unbonding delegations for an individual delegator on an individual validator.

***Usage***

```
firmachaind query staking unbonding-delegation <delegator-addr> <validator-addr>
```

***Example***

```
firmachaind query staking unbonding-delegation firma1e..y5a43qc firmavaloper..y2w72qk
```

### `unbonding-delegations`

Query unbonding delegations for an individual delegator.

***Usage***

```
firmachaind query staking unbonding-delegations <delegator-addr>
```

***Example***

```
firmachaind query staking unbonding-delegations firma1e..y5a43qc
```

### `unbonding-delegations-from`

Query delegations that are unbonding 'from' a validator.

***Usage***

```
firmachaind query staking unbonding-delegations-from <validator-addr>
```

***Example***

```
firmachaind query staking unbonding-delegations-from firmavaloper..y2w72qk
```

### `validator`

Query details about an individual validator.

***Usage***

```
firmachaind query staking validator <validator-addr>
```

***Example***

```
firmachaind query staking validator firmavaloper..y2w72qk
```

### `validators`

Query details about all validators on a network.

***Usage***

```
firmachaind query staking validators
```

## tx

Search transactions using the transaction hash, account sequence and signature information.

***Usage (for hash)***

```
firmachaind query tx <hash>
```

***Usage (for account sequence)***

```
firmachaind query tx --type=acc_seq <addr>/<sequence>
```

***Usage (for signature)***

```
firmachaind query tx --type=signature <sig1_base64>,<sig2_base64...>
```

## txs

Search for transactions that match the exact given events where results are paginated. Each event takes the form of '{eventType}.{eventAttribute}={value}'. Please refer to each module's documentation for the full set of events to query for. Each module documents its respective events under 'xx\_events.md'.

***Usage***

```
firmachaind query txs --events <events>
```

***Example***

```
'message.sender=firma1...&message.action=withdraw_delegator_reward' --page 1 --limit 30
```

## wasm

Querying commands for the wasm module

### `build-address`

build contract address

***Usage***

```
firmachaind query wasm build-address <code-hash> <creator-address> <salt-hex-encoded> <json_encoded_init_args (required when set as fixed)>
```

***Example***

```
firmachaind query wasm build-address 
```

### `code`

Downloads wasm bytecode for given code id

***Usage***

```
firmachaind query wasm code <code_id> <output filename>
```

***Example***

```
firmachaind query wasm code 1 "codeFile"
```

### `code-info`

Prints out metadata of a code id

***Usage***

```
firmachaind query wasm code-info <code_id>
```

***Example***

```
firmachaind query wasm code-info 1
```

### `contract`

Prints out metadata of a contract given its address

```
# usage
firmachaind query wasm contract <bech32_address>
```

### `contract-history`

Prints out the code history for a contract given its address.

***Usage***

```
firmachaind query wasm contract-history <bech32_address>
```

***Example***

```
firmachaind query wasm contract-history ""
```

### `contract-state all`

Prints out all internal state of a contract given its address

***Usage***

```
firmachaind query wasm contract-state all <bech32_address>
```

***Example***

```
firmachaind query wasm contract-state all ""
```

### `contract-state raw`

Prints out internal state for of a contract given its address

***Usage***

```
firmachaind query wasm contract-state raw <bech32_address>
```

***Example***

```
firmachaind query wasm contract-state raw ""
```

### `contract-state smart`

Calls contract with given address with query data and prints the returned result

***Usage***

```
firmachaind query wasm contract-state smart <bech32_address>
```

***Example***

```
firmachaind query wasm contract-state smart <bech32_address>
```

### `libwasmvm-version`

Get libwasmvm version

***Usage***

```
firmachaind query wasm libwasmvm-version
```

### `list-code`

List all wasm bytecode on the chain

***Usage***

```
firmachaind query wasm list-code
```

### `list-contract-by-code`

List wasm all bytecode on the chain for given code id

***Usage***

```
firmachaind query wasm list-contract-by-code <code-id>
```

***Example***

```
firmachaind query wasm list-contract-by-code 1
```

### `params`

Query the current wasm parameters

***Usage***

```
firmachaind query wasm params
```

### `pinned`

List all pinned code ids

***Usage***

```
firmachaind query wasm pinned
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.firmachain.org/master/developer/firmachaind/sub-commands/query-q.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
