Transactions

Cosmos-SDK Governance module transactions commands

The tx commands allow users to interact with the gov module.

sged tx gov --help

Deposit

The deposit command allows users to deposit tokens for a given proposal.

sged tx gov deposit [proposal-id] [deposit] [flags]

Example:

sged tx gov deposit 1 10000000usge --from sge1..

Draft Proposal

The draft-proposal command allows users to draft any type of proposal. The command returns a draft_proposal.json, to be used by submit-proposal after being completed. The draft_metadata.json is meant to be uploaded to IPFS.

sged tx gov draft-proposal

Submit Proposal

The submit-proposal command allows users to submit a governance proposal along with some messages and metadata. Messages, metadata and deposit are defined in a JSON file.

sged tx gov submit-proposal [path-to-proposal-json] [flags]

Example:

sged tx gov submit-proposal /path/to/proposal.json --from sge1..

where proposal.json contains:

{
  "messages": [
    {
      "@type": "/cosmos.bank.v1beta1.MsgSend",
      "from_address": "cosmos1...", // The gov module module address
      "to_address": "cosmos1...",
      "amount":[{"denom": "usge","amount": "10"}]
    }
  ],
  "metadata": "AQ==",
  "deposit": "10usge"
}

Submit Legacy Proposal

The submit-legacy-proposal command allows users to submit a governance legacy proposal along with an initial deposit.

sged tx gov submit-legacy-proposal [command] [flags]

Example:

sged tx gov submit-legacy-proposal --title="Test Proposal" --description="testing" --type="Text" --deposit="100000000usge" --from sge1..

Example (cancel-software-upgrade):

sged tx gov submit-legacy-proposal cancel-software-upgrade --title="Test Proposal" --description="testing" --deposit="100000000usge" --from sge1..

Example (community-pool-spend):

sged tx gov submit-legacy-proposal community-pool-spend proposal.json --from sge1..
{
  "title": "Test Proposal",
  "description": "testing, 1, 2, 3",
  "recipient": "cosmos1..",
  "amount": "10000000usge",
  "deposit": "10000000usge"
}

Example (param-change):

{
  "title": "Test Proposal",
  "description": "testing, testing, 1, 2, 3",
  "changes": [
    {
      "subspace": "staking",
      "key": "MaxValidators",
      "value": 100
    }
  ],
  "deposit": "10000000usge"
}

Example (software-upgrade):

sged tx gov submit-legacy-proposal software-upgrade v2 --title="Test Proposal" --description="testing, testing, 1, 2, 3" --upgrade-height 1000000 --from sge1..

Vote

The vote command allows users to submit a vote for a given governance proposal.

sged tx gov vote [command] [flags]

Example:

sged tx gov vote 1 yes --from sge1..

Weighted Vote

The weighted-vote command allows users to submit a weighted vote for a given governance proposal.

sged tx gov weighted-vote [proposal-id] [weighted-options] [flags]

Example:

sged tx gov weighted-vote 1 yes=0.5,no=0.5 --from sge1..

For detailed information see the original document.

Last updated