Skip to main content

x/gov

Transactions

tx gov submit-proposal

  • Submit a parameter change proposal - param-change [proposal-file]

Users can submit a proposal to modify network parameters during runtime. Here is a demo proposal if we would like to change the parameter MaxValidators (maximum number of validators) in the staking module

{
"title": "Staking Param Change",
"description": "Update max validators",
"changes": [
{
"subspace": "staking",
"key": "MaxValidators",
"value": 151
}
]
}
  • Submit a community pool spend proposal - community-pool-spend [proposal-file]

Users can submit a proposal and request funds from the community pool to support their projects or other usages.

  • Submit a software upgrade proposal- software-upgrade [name] (--upgrade-height [height] | --upgrade-time [time]) (--upgrade-info [info])

Users can submit an upgrade proposal and suggest a software upgrade at a specific block height.

  • Cancel the current software upgrade proposal - cancel-software-upgrade

On the other hand, users can submit a proposal to cancel the planned software upgrade.

tx gov deposit [proposal-id] [deposit]

Users can submit a deposit transaction to fund and support an active proposal.

tx gov vote [proposal-id] [option]

Users can vote for an active proposal. Valid value of "option" field can be "yes", "no", "no_with_veto" and "abstain".

Queries

query gov proposals

We can check all proposals by:

$ shareledger query gov proposals -o json

{
"proposals": [
{
"proposal_id": "1",
"content": {
"@type": "/cosmos.params.v1beta1.ParameterChangeProposal",
"title": "Staking Param Change",
"description": "Update max validators",
"changes": [
{
"subspace": "staking",
"key": "MaxValidators",
"value": "151"
}
]
},
"status": "PROPOSAL_STATUS_PASSED",
"final_tally_result": {
"yes": "50040000000000",
"abstain": "0",
"no": "0",
"no_with_veto": "0"
},
"submit_time": "2020-10-15T10:05:49.996956080Z",
"deposit_end_time": "2020-10-15T22:05:49.996956080Z",
"total_deposit": [
{
"denom": "nshr",
"amount": "10000000000000000"
}
],
"voting_start_time": "2022-10-15T10:14:56.958963929Z",
"voting_end_time": "2022-10-15T22:14:56.958963929Z"
}
],
"pagination": {
"next_key": null,
"total": "0"
}
}

In the above example, there is only one proposal with "proposal_id": "1", with the title: "Staking Param Change" that change the MaxValidators parameter of the staking module to 151. We can also see that the status of the proposal is "PROPOSAL_STATUS_PASSED", which means that this proposal has been passed.

query gov proposal [proposal-id]

Similarly, we can check the details of a proposal with a given "proposal_id"

query gov tally [proposal-id]

We can also check the tally of a proposal with a given "proposal_id".