1"use strict";(self.webpackChunkcosmwasm_documentation=self.webpackChunkcosmwasm_documentation||[]).push([["3138"],{6317(e,n,s){s.r(n),s.d(n,{metadata:()=>o,default:()=>h,frontMatter:()=>a,contentTitle:()=>r,toc:()=>l,assets:()=>d});var o=JSON.parse('{"id":"wasmd/getting-started/proposals","title":"Proposals","description":"Proposals are a fundamental part of the governance process in the Cosmos ecosystem. They enable","source":"@site/docs/wasmd/getting-started/proposals.md","sourceDirName":"wasmd/getting-started","slug":"/wasmd/getting-started/proposals","permalink":"/wasmd/getting-started/proposals","draft":false,"unlisted":false,"tags":[],"version":"current","lastUpdatedAt":1759826769000,"sidebarPosition":4,"frontMatter":{"sidebar_position":4},"sidebar":"tutorialSidebar","previous":{"title":"Interact via CLI","permalink":"/wasmd/getting-started/cli"},"next":{"title":"Permissions","permalink":"/wasmd/getting-started/permissions"}}'),t=s(4848),i=s(8453);let a={sidebar_position:4},r="Proposals",d={},l=[{value:"Overview of the Proposal Process",id:"overview-of-the-proposal-process",level:2},{value:"Submit a CosmWasm proposal",id:"submit-a-cosmwasm-proposal",level:2},{value:"Pin Codes",id:"pin-codes",level:3},{value:"Unpin codes",id:"unpin-codes",level:3}];function c(e){let n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",ol:"ol",p:"p",pre:"pre",ul:"ul",...(0,i.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.header,{children:(0,t.jsx)(n.h1,{id:"proposals",children:"Proposals"})}),"\n",(0,t.jsx)(n.p,{children:"Proposals are a fundamental part of the governance process in the Cosmos ecosystem. They enable\nvalidators to vote on important decisions that impact the network, such as software upgrades,\nparameter changes, and the allocation of community funds."}),"\n",(0,t.jsx)(n.h2,{id:"overview-of-the-proposal-process",children:"Overview of the Proposal Process"}),"\n",(0,t.jsxs)(n.ol,{children:["\n",(0,t.jsx)(n.li,{children:"Submission: A proposal is submitted along with a deposit to the network."}),"\n",(0,t.jsx)(n.li,{children:"Deposit Period: Other participants can contribute to the deposit. If the minimum deposit is met,\nthe proposal moves to the voting stage."}),"\n",(0,t.jsx)(n.li,{children:"Voting Period: Validators and delegators vote on the proposal."}),"\n",(0,t.jsx)(n.li,{children:"Tallying: After the voting period ends, the votes are tallied to determine whether the proposal\nhas passed or failed."}),"\n",(0,t.jsx)(n.li,{children:"Execution: If the proposal passes, it is executed according to the details specified in the\nproposal, such as implementing a parameter change or initiating a software upgrade."}),"\n"]}),"\n",(0,t.jsx)(n.p,{children:"In this section, we'll dive into how to submit CosmWasm proposals. The submission process is a bit\ndifferent from the Cosmos SDK, but the rest, including the deposit period, voting, tallying, and\nexecution, follows the usual Cosmos SDK governance process."}),"\n",(0,t.jsxs)(n.p,{children:["For more details on the ",(0,t.jsx)(n.code,{children:"gov"})," module, check out the\n",(0,t.jsx)(n.a,{href:"https://docs.cosmos.network/v0.50/build/modules/gov",children:"Cosmos SDK Governance Documentation"})," and the\n",(0,t.jsx)(n.a,{href:"https://tutorials.cosmos.network/tutorials/8-understand-sdk-modules/4-gov.html",children:"Cosmos SDK Proposal Tutorial"}),"."]}),"\n",(0,t.jsx)(n.h2,{id:"submit-a-cosmwasm-proposal",children:"Submit a CosmWasm proposal"}),"\n",(0,t.jsxs)(n.p,{children:["You can submit a CosmWasm proposal using the ",(0,t.jsx)(n.code,{children:"wasmd tx wasm submit-proposal"})," command. To see a full\nlist of available proposal types, simply add the ",(0,t.jsx)(n.code,{children:"--help"})," flag. Many of these commands, like\n",(0,t.jsx)(n.code,{children:"wasm-store"}),", ",(0,t.jsx)(n.code,{children:"instantiate-contract"}),", ",(0,t.jsx)(n.code,{children:"execute-contract"}),", ",(0,t.jsx)(n.code,{children:"migrate-contract"}),", are similar to the\nstandard ",(0,t.jsx)(n.code,{children:"tx"})," commands and won't be covered in detail here. Instead, we'll focus on the commands\nthat are only available through a proposal such as ",(0,t.jsx)(n.code,{children:"pin-codes"}),", ",(0,t.jsx)(n.code,{children:"unpin-codes"})," and ",(0,t.jsx)(n.code,{children:"sudo-contract"}),"."]}),"\n",(0,t.jsx)(n.h3,{id:"pin-codes",children:"Pin Codes"}),"\n",(0,t.jsxs)(n.p,{children:["Pinning a code means keeping a specific Wasm code stored in the cache. This improves the performance\nof frequently used contracts by avoiding the need to reload the code from the blockchain, which\nleads to lower gas costs during contract execution. For more details about code pinning you can\ncheck the ",(0,t.jsx)(n.a,{href:"../../core/architecture/pinning",children:"Contract pinning section"}),"."]}),"\n",(0,t.jsx)(n.p,{children:"To submit a proposal for pinning a code, you can use the following command:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-shell",children:'wasmd tx wasm submit-proposal pin-codes $CODE_ID \\\n --title "Pin Code $CODE_ID" \\\n --summary "Pin Code $CODE_ID Proposal" \\\n --from alice \\\n --gas 1500000 \\\n -y \\\n --chain-id=docs-chain-1 \\\n -o json \\\n --keyring-backend=test \\\n --deposit 100000stake\n'})}),"\n",(0,t.jsxs)(n.p,{children:["You can pin multiple codes by providing a list of code IDs instead of just a single ",(0,t.jsx)(n.code,{children:"code_id"}),". The\n",(0,t.jsx)(n.code,{children:"title"})," flag specifies the title of the proposal, which should be descriptive and concise, while the\n",(0,t.jsx)(n.code,{children:"summary"})," flag provides a brief explanation of what the proposal aims to achieve. The ",(0,t.jsx)(n.code,{children:"deposit"})," flag\nindicates the number of tokens required to submit the proposal, avoiding spam proposals submissions."]}),"\n",(0,t.jsxs)(n.p,{children:["To check the details of a submitted proposal, you can query the transaction using the ",(0,t.jsx)(n.code,{children:"txhash"}),"\nprovided in the command output. This allows you to inspect the emitted events and retrieve the\n",(0,t.jsx)(n.code,{children:"proposal ID"}),", as shown in the following example:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n ...\n "events": [\n ...\n {\n "type": "submit_proposal",\n "attributes": [\n {\n "key": "proposal_id",\n "value": "2",\n "index": true\n },\n {\n "key": "proposal_proposer",\n "value": "wasm10gftgfm8my3f3hymne8327rrzyvy7dqrkucej5",\n "index": true\n },\n {\n "key": "proposal_messages",\n "value": ",/cosmwasm.wasm.v1.MsgPinCodes",\n "index": true\n },\n {\n "key": "msg_index",\n "value": "0",\n "index": true\n }\n ]\n }\n ]\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["Once you have the ",(0,t.jsx)(n.code,{children:"proposal ID"}),", you can fetch the full proposal details using the following command:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-shell",children:"wasmd q gov proposal 2 -o json\n"})}),"\n",(0,t.jsx)(n.p,{children:"The command will return a JSON object similar to the following:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "proposal": {\n "id": "2",\n "messages": [\n {\n "type": "wasm/MsgPinCodes",\n "value": {\n "authority": "
1wasm10d07y265gmmuvt4z0w9aw880jnsr700js7zslc",\n "code_ids": ["1"]\n }\n }\n ],\n "status": 1,\n "final_tally_result": {\n "yes_count": "0",\n "abstain_count": "0",\n "no_count": "0",\n "no_with_veto_count": "0"\n },\n "submit_time": "2024-08-08T16:48:32.640792888Z",\n "deposit_end_time": "2024-08-10T16:48:32.640792888Z",\n "total_deposit": [\n {\n "denom": "stake",\n "amount": "100000"\n }\n ],\n "title": "Pin Code 1",\n "summary": "Pin Code 1 Proposal",\n "proposer": "wasm10gftgfm8my3f3hymne8327rrzyvy7dqrkucej5"\n }\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"id"})," - this is the unique identifier for the proposal,"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"messages"}),": This array contains the specific actions or commands the proposal intends to execute,"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"status"}),": Indicates the current status of the proposal,"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"final_tally_result"}),": Shows the results of the voting on the proposal,"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"submit_time"}),": The timestamp indicating when the proposal was submitted,"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"deposit_end_time"}),": The timestamp indicating when the deposit period ends,"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"total_deposit"}),": This is the amount of tokens that has been deposited to support the proposal,"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"title"}),": Title of the proposal,"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"summary"}),": Summary of the proposal,"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"proposer"}),": The address of the entity that submitted the proposal."]}),"\n"]}),"\n",(0,t.jsx)(n.p,{children:"After the deposit period and voting period, if the proposal passes and is executed, the code is then\npinned. You can verify the pinned codes by querying them with the following command:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-shell",children:"wasmd q wasm pinned -o json\n"})}),"\n",(0,t.jsx)(n.p,{children:"The command will return a JSON object similar to the following:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "code_ids": [1, 2, 3],\n "pagination": {\n "next_key": null,\n "total": "0"\n }\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["The ",(0,t.jsx)(n.code,{children:"code_ids"})," array lists all the code IDs that are currently pinned."]}),"\n",(0,t.jsx)(n.h3,{id:"unpin-codes",children:"Unpin codes"}),"\n",(0,t.jsx)(n.p,{children:"To remove a code from the cache and unpin it, you can submit an unpin proposal using the following command:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-shell",children:'wasmd tx wasm submit-proposal unpin-codes $CODE_ID \\\n --title "Pin Code $CODE_ID" \\\n --summary "Pin Code $CODE_ID Proposal" \\\n --from alice \\\n --gas 1500000 \\\n -y \\\n --chain-id=docs-chain-1 \\\n -o json \\\n --keyring-backend=test \\\n --deposit 100000stake\n'})}),"\n",(0,t.jsxs)(n.p,{children:["The rest of the process follows the same steps as pinning codes, so we won't go into detail again.\nAfter the proposal is executed, you can confirm that the code is no longer pinned by using\nthe ",(0,t.jsx)(n.code,{children:"wasmd q wasm pinned"})," command."]})]})}function h(e={}){let{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453(e,n,s){s.d(n,{R:()=>a,x:()=>r});var o=s(6540);let t={},i=o.createContext(t);function a(e){let n=o.useContext(i);return o.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function r(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:a(e.components),o.createElement(i.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.