github.com/cosmos/cosmos-sdk@v0.50.10/x/group/README.md (about) 1 --- 2 sidebar_position: 1 3 --- 4 5 # `x/group` 6 7 ## Abstract 8 9 The following documents specify the group module. 10 11 This module allows the creation and management of on-chain multisig accounts and enables voting for message execution based on configurable decision policies. 12 13 ## Contents 14 15 * [Concepts](#concepts) 16 * [Group](#group) 17 * [Group Policy](#group-policy) 18 * [Decision Policy](#decision-policy) 19 * [Proposal](#proposal) 20 * [Pruning](#pruning) 21 * [State](#state) 22 * [Group Table](#group-table) 23 * [Group Member Table](#group-member-table) 24 * [Group Policy Table](#group-policy-table) 25 * [Proposal Table](#proposal-table) 26 * [Vote Table](#vote-table) 27 * [Msg Service](#msg-service) 28 * [Msg/CreateGroup](#msgcreategroup) 29 * [Msg/UpdateGroupMembers](#msgupdategroupmembers) 30 * [Msg/UpdateGroupAdmin](#msgupdategroupadmin) 31 * [Msg/UpdateGroupMetadata](#msgupdategroupmetadata) 32 * [Msg/CreateGroupPolicy](#msgcreategrouppolicy) 33 * [Msg/CreateGroupWithPolicy](#msgcreategroupwithpolicy) 34 * [Msg/UpdateGroupPolicyAdmin](#msgupdategrouppolicyadmin) 35 * [Msg/UpdateGroupPolicyDecisionPolicy](#msgupdategrouppolicydecisionpolicy) 36 * [Msg/UpdateGroupPolicyMetadata](#msgupdategrouppolicymetadata) 37 * [Msg/SubmitProposal](#msgsubmitproposal) 38 * [Msg/WithdrawProposal](#msgwithdrawproposal) 39 * [Msg/Vote](#msgvote) 40 * [Msg/Exec](#msgexec) 41 * [Msg/LeaveGroup](#msgleavegroup) 42 * [Events](#events) 43 * [EventCreateGroup](#eventcreategroup) 44 * [EventUpdateGroup](#eventupdategroup) 45 * [EventCreateGroupPolicy](#eventcreategrouppolicy) 46 * [EventUpdateGroupPolicy](#eventupdategrouppolicy) 47 * [EventCreateProposal](#eventcreateproposal) 48 * [EventWithdrawProposal](#eventwithdrawproposal) 49 * [EventVote](#eventvote) 50 * [EventExec](#eventexec) 51 * [EventLeaveGroup](#eventleavegroup) 52 * [EventProposalPruned](#eventproposalpruned) 53 * [Client](#client) 54 * [CLI](#cli) 55 * [gRPC](#grpc) 56 * [REST](#rest) 57 * [Metadata](#metadata) 58 59 ## Concepts 60 61 ### Group 62 63 A group is simply an aggregation of accounts with associated weights. It is not 64 an account and doesn't have a balance. It doesn't in and of itself have any 65 sort of voting or decision weight. It does have an "administrator" which has 66 the ability to add, remove and update members in the group. Note that a 67 group policy account could be an administrator of a group, and that the 68 administrator doesn't necessarily have to be a member of the group. 69 70 ### Group Policy 71 72 A group policy is an account associated with a group and a decision policy. 73 Group policies are abstracted from groups because a single group may have 74 multiple decision policies for different types of actions. Managing group 75 membership separately from decision policies results in the least overhead 76 and keeps membership consistent across different policies. The pattern that 77 is recommended is to have a single master group policy for a given group, 78 and then to create separate group policies with different decision policies 79 and delegate the desired permissions from the master account to 80 those "sub-accounts" using the `x/authz` module. 81 82 ### Decision Policy 83 84 A decision policy is the mechanism by which members of a group can vote on 85 proposals, as well as the rules that dictate whether a proposal should pass 86 or not based on its tally outcome. 87 88 All decision policies generally would have a mininum execution period and a 89 maximum voting window. The minimum execution period is the minimum amount of time 90 that must pass after submission in order for a proposal to potentially be executed, and it may 91 be set to 0. The maximum voting window is the maximum time after submission that a proposal may 92 be voted on before it is tallied. 93 94 The chain developer also defines an app-wide maximum execution period, which is 95 the maximum amount of time after a proposal's voting period end where users are 96 allowed to execute a proposal. 97 98 The current group module comes shipped with two decision policies: threshold 99 and percentage. Any chain developer can extend upon these two, by creating 100 custom decision policies, as long as they adhere to the `DecisionPolicy` 101 interface: 102 103 ```go reference 104 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/group/types.go#L27-L45 105 ``` 106 107 #### Threshold decision policy 108 109 A threshold decision policy defines a threshold of yes votes (based on a tally 110 of voter weights) that must be achieved in order for a proposal to pass. For 111 this decision policy, abstain and veto are simply treated as no's. 112 113 This decision policy also has a VotingPeriod window and a MinExecutionPeriod 114 window. The former defines the duration after proposal submission where members 115 are allowed to vote, after which tallying is performed. The latter specifies 116 the minimum duration after proposal submission where the proposal can be 117 executed. If set to 0, then the proposal is allowed to be executed immediately 118 on submission (using the `TRY_EXEC` option). Obviously, MinExecutionPeriod 119 cannot be greater than VotingPeriod+MaxExecutionPeriod (where MaxExecution is 120 the app-defined duration that specifies the window after voting ended where a 121 proposal can be executed). 122 123 #### Percentage decision policy 124 125 A percentage decision policy is similar to a threshold decision policy, except 126 that the threshold is not defined as a constant weight, but as a percentage. 127 It's more suited for groups where the group members' weights can be updated, as 128 the percentage threshold stays the same, and doesn't depend on how those member 129 weights get updated. 130 131 Same as the Threshold decision policy, the percentage decision policy has the 132 two VotingPeriod and MinExecutionPeriod parameters. 133 134 ### Proposal 135 136 Any member(s) of a group can submit a proposal for a group policy account to decide upon. 137 A proposal consists of a set of messages that will be executed if the proposal 138 passes as well as any metadata associated with the proposal. 139 140 #### Voting 141 142 There are four choices to choose while voting - yes, no, abstain and veto. Not 143 all decision policies will take the four choices into account. Votes can contain some optional metadata. 144 In the current implementation, the voting window begins as soon as a proposal 145 is submitted, and the end is defined by the group policy's decision policy. 146 147 #### Withdrawing Proposals 148 149 Proposals can be withdrawn any time before the voting period end, either by the 150 admin of the group policy or by one of the proposers. Once withdrawn, it is 151 marked as `PROPOSAL_STATUS_WITHDRAWN`, and no more voting or execution is 152 allowed on it. 153 154 #### Aborted Proposals 155 156 If the group policy is updated during the voting period of the proposal, then 157 the proposal is marked as `PROPOSAL_STATUS_ABORTED`, and no more voting or 158 execution is allowed on it. This is because the group policy defines the rules 159 of proposal voting and execution, so if those rules change during the lifecycle 160 of a proposal, then the proposal should be marked as stale. 161 162 #### Tallying 163 164 Tallying is the counting of all votes on a proposal. It happens only once in 165 the lifecycle of a proposal, but can be triggered by two factors, whichever 166 happens first: 167 168 * either someone tries to execute the proposal (see next section), which can 169 happen on a `Msg/Exec` transaction, or a `Msg/{SubmitProposal,Vote}` 170 transaction with the `Exec` field set. When a proposal execution is attempted, 171 a tally is done first to make sure the proposal passes. 172 * or on `EndBlock` when the proposal's voting period end just passed. 173 174 If the tally result passes the decision policy's rules, then the proposal is 175 marked as `PROPOSAL_STATUS_ACCEPTED`, or else it is marked as 176 `PROPOSAL_STATUS_REJECTED`. In any case, no more voting is allowed anymore, and the tally 177 result is persisted to state in the proposal's `FinalTallyResult`. 178 179 #### Executing Proposals 180 181 Proposals are executed only when the tallying is done, and the group account's 182 decision policy allows the proposal to pass based on the tally outcome. They 183 are marked by the status `PROPOSAL_STATUS_ACCEPTED`. Execution must happen 184 before a duration of `MaxExecutionPeriod` (set by the chain developer) after 185 each proposal's voting period end. 186 187 Proposals will not be automatically executed by the chain in this current design, 188 but rather a user must submit a `Msg/Exec` transaction to attempt to execute the 189 proposal based on the current votes and decision policy. Any user (not only the 190 group members) can execute proposals that have been accepted, and execution fees are 191 paid by the proposal executor. 192 It's also possible to try to execute a proposal immediately on creation or on 193 new votes using the `Exec` field of `Msg/SubmitProposal` and `Msg/Vote` requests. 194 In the former case, proposers signatures are considered as yes votes. 195 In these cases, if the proposal can't be executed (i.e. it didn't pass the 196 decision policy's rules), it will still be opened for new votes and 197 could be tallied and executed later on. 198 199 A successful proposal execution will have its `ExecutorResult` marked as 200 `PROPOSAL_EXECUTOR_RESULT_SUCCESS`. The proposal will be automatically pruned 201 after execution. On the other hand, a failed proposal execution will be marked 202 as `PROPOSAL_EXECUTOR_RESULT_FAILURE`. Such a proposal can be re-executed 203 multiple times, until it expires after `MaxExecutionPeriod` after voting period 204 end. 205 206 ### Pruning 207 208 Proposals and votes are automatically pruned to avoid state bloat. 209 210 Votes are pruned: 211 212 * either after a successful tally, i.e. a tally whose result passes the decision 213 policy's rules, which can be trigged by a `Msg/Exec` or a 214 `Msg/{SubmitProposal,Vote}` with the `Exec` field set, 215 * or on `EndBlock` right after the proposal's voting period end. This applies to proposals with status `aborted` or `withdrawn` too. 216 217 whichever happens first. 218 219 Proposals are pruned: 220 221 * on `EndBlock` whose proposal status is `withdrawn` or `aborted` on proposal's voting period end before tallying, 222 * and either after a successful proposal execution, 223 * or on `EndBlock` right after the proposal's `voting_period_end` + 224 `max_execution_period` (defined as an app-wide configuration) is passed, 225 226 whichever happens first. 227 228 ## State 229 230 The `group` module uses the `orm` package which provides table storage with support for 231 primary keys and secondary indexes. `orm` also defines `Sequence` which is a persistent unique key generator based on a counter that can be used along with `Table`s. 232 233 Here's the list of tables and associated sequences and indexes stored as part of the `group` module. 234 235 ### Group Table 236 237 The `groupTable` stores `GroupInfo`: `0x0 | BigEndian(GroupId) -> ProtocolBuffer(GroupInfo)`. 238 239 #### groupSeq 240 241 The value of `groupSeq` is incremented when creating a new group and corresponds to the new `GroupId`: `0x1 | 0x1 -> BigEndian`. 242 243 The second `0x1` corresponds to the ORM `sequenceStorageKey`. 244 245 #### groupByAdminIndex 246 247 `groupByAdminIndex` allows to retrieve groups by admin address: 248 `0x2 | len([]byte(group.Admin)) | []byte(group.Admin) | BigEndian(GroupId) -> []byte()`. 249 250 ### Group Member Table 251 252 The `groupMemberTable` stores `GroupMember`s: `0x10 | BigEndian(GroupId) | []byte(member.Address) -> ProtocolBuffer(GroupMember)`. 253 254 The `groupMemberTable` is a primary key table and its `PrimaryKey` is given by 255 `BigEndian(GroupId) | []byte(member.Address)` which is used by the following indexes. 256 257 #### groupMemberByGroupIndex 258 259 `groupMemberByGroupIndex` allows to retrieve group members by group id: 260 `0x11 | BigEndian(GroupId) | PrimaryKey -> []byte()`. 261 262 #### groupMemberByMemberIndex 263 264 `groupMemberByMemberIndex` allows to retrieve group members by member address: 265 `0x12 | len([]byte(member.Address)) | []byte(member.Address) | PrimaryKey -> []byte()`. 266 267 ### Group Policy Table 268 269 The `groupPolicyTable` stores `GroupPolicyInfo`: `0x20 | len([]byte(Address)) | []byte(Address) -> ProtocolBuffer(GroupPolicyInfo)`. 270 271 The `groupPolicyTable` is a primary key table and its `PrimaryKey` is given by 272 `len([]byte(Address)) | []byte(Address)` which is used by the following indexes. 273 274 #### groupPolicySeq 275 276 The value of `groupPolicySeq` is incremented when creating a new group policy and is used to generate the new group policy account `Address`: 277 `0x21 | 0x1 -> BigEndian`. 278 279 The second `0x1` corresponds to the ORM `sequenceStorageKey`. 280 281 #### groupPolicyByGroupIndex 282 283 `groupPolicyByGroupIndex` allows to retrieve group policies by group id: 284 `0x22 | BigEndian(GroupId) | PrimaryKey -> []byte()`. 285 286 #### groupPolicyByAdminIndex 287 288 `groupPolicyByAdminIndex` allows to retrieve group policies by admin address: 289 `0x23 | len([]byte(Address)) | []byte(Address) | PrimaryKey -> []byte()`. 290 291 ### Proposal Table 292 293 The `proposalTable` stores `Proposal`s: `0x30 | BigEndian(ProposalId) -> ProtocolBuffer(Proposal)`. 294 295 #### proposalSeq 296 297 The value of `proposalSeq` is incremented when creating a new proposal and corresponds to the new `ProposalId`: `0x31 | 0x1 -> BigEndian`. 298 299 The second `0x1` corresponds to the ORM `sequenceStorageKey`. 300 301 #### proposalByGroupPolicyIndex 302 303 `proposalByGroupPolicyIndex` allows to retrieve proposals by group policy account address: 304 `0x32 | len([]byte(account.Address)) | []byte(account.Address) | BigEndian(ProposalId) -> []byte()`. 305 306 #### ProposalsByVotingPeriodEndIndex 307 308 `proposalsByVotingPeriodEndIndex` allows to retrieve proposals sorted by chronological `voting_period_end`: 309 `0x33 | sdk.FormatTimeBytes(proposal.VotingPeriodEnd) | BigEndian(ProposalId) -> []byte()`. 310 311 This index is used when tallying the proposal votes at the end of the voting period, and for pruning proposals at `VotingPeriodEnd + MaxExecutionPeriod`. 312 313 ### Vote Table 314 315 The `voteTable` stores `Vote`s: `0x40 | BigEndian(ProposalId) | []byte(voter.Address) -> ProtocolBuffer(Vote)`. 316 317 The `voteTable` is a primary key table and its `PrimaryKey` is given by 318 `BigEndian(ProposalId) | []byte(voter.Address)` which is used by the following indexes. 319 320 #### voteByProposalIndex 321 322 `voteByProposalIndex` allows to retrieve votes by proposal id: 323 `0x41 | BigEndian(ProposalId) | PrimaryKey -> []byte()`. 324 325 #### voteByVoterIndex 326 327 `voteByVoterIndex` allows to retrieve votes by voter address: 328 `0x42 | len([]byte(voter.Address)) | []byte(voter.Address) | PrimaryKey -> []byte()`. 329 330 ## Msg Service 331 332 ### Msg/CreateGroup 333 334 A new group can be created with the `MsgCreateGroup`, which has an admin address, a list of members and some optional metadata. 335 336 The metadata has a maximum length that is chosen by the app developer, and 337 passed into the group keeper as a config. 338 339 ```go reference 340 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L67-L80 341 ``` 342 343 It's expected to fail if 344 345 * metadata length is greater than `MaxMetadataLen` config 346 * members are not correctly set (e.g. wrong address format, duplicates, or with 0 weight). 347 348 ### Msg/UpdateGroupMembers 349 350 Group members can be updated with the `UpdateGroupMembers`. 351 352 ```go reference 353 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L88-L102 354 ``` 355 356 In the list of `MemberUpdates`, an existing member can be removed by setting its weight to 0. 357 358 It's expected to fail if: 359 360 * the signer is not the admin of the group. 361 * for any one of the associated group policies, if its decision policy's `Validate()` method fails against the updated group. 362 363 ### Msg/UpdateGroupAdmin 364 365 The `UpdateGroupAdmin` can be used to update a group admin. 366 367 ```go reference 368 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L107-L120 369 ``` 370 371 It's expected to fail if the signer is not the admin of the group. 372 373 ### Msg/UpdateGroupMetadata 374 375 The `UpdateGroupMetadata` can be used to update a group metadata. 376 377 ```go reference 378 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L125-L138 379 ``` 380 381 It's expected to fail if: 382 383 * new metadata length is greater than `MaxMetadataLen` config. 384 * the signer is not the admin of the group. 385 386 ### Msg/CreateGroupPolicy 387 388 A new group policy can be created with the `MsgCreateGroupPolicy`, which has an admin address, a group id, a decision policy and some optional metadata. 389 390 ```go reference 391 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L147-L165 392 ``` 393 394 It's expected to fail if: 395 396 * the signer is not the admin of the group. 397 * metadata length is greater than `MaxMetadataLen` config. 398 * the decision policy's `Validate()` method doesn't pass against the group. 399 400 ### Msg/CreateGroupWithPolicy 401 402 A new group with policy can be created with the `MsgCreateGroupWithPolicy`, which has an admin address, a list of members, a decision policy, a `group_policy_as_admin` field to optionally set group and group policy admin with group policy address and some optional metadata for group and group policy. 403 404 ```go reference 405 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L191-L215 406 ``` 407 408 It's expected to fail for the same reasons as `Msg/CreateGroup` and `Msg/CreateGroupPolicy`. 409 410 ### Msg/UpdateGroupPolicyAdmin 411 412 The `UpdateGroupPolicyAdmin` can be used to update a group policy admin. 413 414 ```go reference 415 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L173-L186 416 ``` 417 418 It's expected to fail if the signer is not the admin of the group policy. 419 420 ### Msg/UpdateGroupPolicyDecisionPolicy 421 422 The `UpdateGroupPolicyDecisionPolicy` can be used to update a decision policy. 423 424 ```go reference 425 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L226-L241 426 ``` 427 428 It's expected to fail if: 429 430 * the signer is not the admin of the group policy. 431 * the new decision policy's `Validate()` method doesn't pass against the group. 432 433 ### Msg/UpdateGroupPolicyMetadata 434 435 The `UpdateGroupPolicyMetadata` can be used to update a group policy metadata. 436 437 ```go reference 438 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L246-L259 439 ``` 440 441 It's expected to fail if: 442 443 * new metadata length is greater than `MaxMetadataLen` config. 444 * the signer is not the admin of the group. 445 446 ### Msg/SubmitProposal 447 448 A new proposal can be created with the `MsgSubmitProposal`, which has a group policy account address, a list of proposers addresses, a list of messages to execute if the proposal is accepted and some optional metadata. 449 An optional `Exec` value can be provided to try to execute the proposal immediately after proposal creation. Proposers signatures are considered as yes votes in this case. 450 451 ```go reference 452 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L281-L315 453 ``` 454 455 It's expected to fail if: 456 457 * metadata, title, or summary length is greater than `MaxMetadataLen` config. 458 * if any of the proposers is not a group member. 459 460 ### Msg/WithdrawProposal 461 462 A proposal can be withdrawn using `MsgWithdrawProposal` which has an `address` (can be either a proposer or the group policy admin) and a `proposal_id` (which has to be withdrawn). 463 464 ```go reference 465 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L323-L333 466 ``` 467 468 It's expected to fail if: 469 470 * the signer is neither the group policy admin nor proposer of the proposal. 471 * the proposal is already closed or aborted. 472 473 ### Msg/Vote 474 475 A new vote can be created with the `MsgVote`, given a proposal id, a voter address, a choice (yes, no, veto or abstain) and some optional metadata. 476 An optional `Exec` value can be provided to try to execute the proposal immediately after voting. 477 478 ```go reference 479 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L338-L358 480 ``` 481 482 It's expected to fail if: 483 484 * metadata length is greater than `MaxMetadataLen` config. 485 * the proposal is not in voting period anymore. 486 487 ### Msg/Exec 488 489 A proposal can be executed with the `MsgExec`. 490 491 ```go reference 492 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L363-L373 493 ``` 494 495 The messages that are part of this proposal won't be executed if: 496 497 * the proposal has not been accepted by the group policy. 498 * the proposal has already been successfully executed. 499 500 ### Msg/LeaveGroup 501 502 The `MsgLeaveGroup` allows group member to leave a group. 503 504 ```go reference 505 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/group/v1/tx.proto#L381-L391 506 ``` 507 508 It's expected to fail if: 509 510 * the group member is not part of the group. 511 * for any one of the associated group policies, if its decision policy's `Validate()` method fails against the updated group. 512 513 ## Events 514 515 The group module emits the following events: 516 517 ### EventCreateGroup 518 519 | Type | Attribute Key | Attribute Value | 520 | -------------------------------- | ------------- | -------------------------------- | 521 | message | action | /cosmos.group.v1.Msg/CreateGroup | 522 | cosmos.group.v1.EventCreateGroup | group_id | {groupId} | 523 524 ### EventUpdateGroup 525 526 | Type | Attribute Key | Attribute Value | 527 | -------------------------------- | ------------- | ---------------------------------------------------------- | 528 | message | action | /cosmos.group.v1.Msg/UpdateGroup{Admin\|Metadata\|Members} | 529 | cosmos.group.v1.EventUpdateGroup | group_id | {groupId} | 530 531 ### EventCreateGroupPolicy 532 533 | Type | Attribute Key | Attribute Value | 534 | -------------------------------------- | ------------- | -------------------------------------- | 535 | message | action | /cosmos.group.v1.Msg/CreateGroupPolicy | 536 | cosmos.group.v1.EventCreateGroupPolicy | address | {groupPolicyAddress} | 537 538 ### EventUpdateGroupPolicy 539 540 | Type | Attribute Key | Attribute Value | 541 | -------------------------------------- | ------------- | ----------------------------------------------------------------------- | 542 | message | action | /cosmos.group.v1.Msg/UpdateGroupPolicy{Admin\|Metadata\|DecisionPolicy} | 543 | cosmos.group.v1.EventUpdateGroupPolicy | address | {groupPolicyAddress} | 544 545 ### EventCreateProposal 546 547 | Type | Attribute Key | Attribute Value | 548 | ----------------------------------- | ------------- | ----------------------------------- | 549 | message | action | /cosmos.group.v1.Msg/CreateProposal | 550 | cosmos.group.v1.EventCreateProposal | proposal_id | {proposalId} | 551 552 ### EventWithdrawProposal 553 554 | Type | Attribute Key | Attribute Value | 555 | ------------------------------------- | ------------- | ------------------------------------- | 556 | message | action | /cosmos.group.v1.Msg/WithdrawProposal | 557 | cosmos.group.v1.EventWithdrawProposal | proposal_id | {proposalId} | 558 559 ### EventVote 560 561 | Type | Attribute Key | Attribute Value | 562 | ------------------------- | ------------- | ------------------------- | 563 | message | action | /cosmos.group.v1.Msg/Vote | 564 | cosmos.group.v1.EventVote | proposal_id | {proposalId} | 565 566 ## EventExec 567 568 | Type | Attribute Key | Attribute Value | 569 | ------------------------- | ------------- | ------------------------- | 570 | message | action | /cosmos.group.v1.Msg/Exec | 571 | cosmos.group.v1.EventExec | proposal_id | {proposalId} | 572 | cosmos.group.v1.EventExec | logs | {logs_string} | 573 574 ### EventLeaveGroup 575 576 | Type | Attribute Key | Attribute Value | 577 | ------------------------------- | ------------- | ------------------------------- | 578 | message | action | /cosmos.group.v1.Msg/LeaveGroup | 579 | cosmos.group.v1.EventLeaveGroup | proposal_id | {proposalId} | 580 | cosmos.group.v1.EventLeaveGroup | address | {address} | 581 582 ### EventProposalPruned 583 584 | Type | Attribute Key | Attribute Value | 585 |-------------------------------------|---------------|---------------------------------| 586 | message | action | /cosmos.group.v1.Msg/LeaveGroup | 587 | cosmos.group.v1.EventProposalPruned | proposal_id | {proposalId} | 588 | cosmos.group.v1.EventProposalPruned | status | {ProposalStatus} | 589 | cosmos.group.v1.EventProposalPruned | tally_result | {TallyResult} | 590 591 592 ## Client 593 594 ### CLI 595 596 A user can query and interact with the `group` module using the CLI. 597 598 #### Query 599 600 The `query` commands allow users to query `group` state. 601 602 ```bash 603 simd query group --help 604 ``` 605 606 ##### group-info 607 608 The `group-info` command allows users to query for group info by given group id. 609 610 ```bash 611 simd query group group-info [id] [flags] 612 ``` 613 614 Example: 615 616 ```bash 617 simd query group group-info 1 618 ``` 619 620 Example Output: 621 622 ```bash 623 admin: cosmos1.. 624 group_id: "1" 625 metadata: AQ== 626 total_weight: "3" 627 version: "1" 628 ``` 629 630 ##### group-policy-info 631 632 The `group-policy-info` command allows users to query for group policy info by account address of group policy . 633 634 ```bash 635 simd query group group-policy-info [group-policy-account] [flags] 636 ``` 637 638 Example: 639 640 ```bash 641 simd query group group-policy-info cosmos1.. 642 ``` 643 644 Example Output: 645 646 ```bash 647 address: cosmos1.. 648 admin: cosmos1.. 649 decision_policy: 650 '@type': /cosmos.group.v1.ThresholdDecisionPolicy 651 threshold: "1" 652 windows: 653 min_execution_period: 0s 654 voting_period: 432000s 655 group_id: "1" 656 metadata: AQ== 657 version: "1" 658 ``` 659 660 ##### group-members 661 662 The `group-members` command allows users to query for group members by group id with pagination flags. 663 664 ```bash 665 simd query group group-members [id] [flags] 666 ``` 667 668 Example: 669 670 ```bash 671 simd query group group-members 1 672 ``` 673 674 Example Output: 675 676 ```bash 677 members: 678 - group_id: "1" 679 member: 680 address: cosmos1.. 681 metadata: AQ== 682 weight: "2" 683 - group_id: "1" 684 member: 685 address: cosmos1.. 686 metadata: AQ== 687 weight: "1" 688 pagination: 689 next_key: null 690 total: "2" 691 ``` 692 693 ##### groups-by-admin 694 695 The `groups-by-admin` command allows users to query for groups by admin account address with pagination flags. 696 697 ```bash 698 simd query group groups-by-admin [admin] [flags] 699 ``` 700 701 Example: 702 703 ```bash 704 simd query group groups-by-admin cosmos1.. 705 ``` 706 707 Example Output: 708 709 ```bash 710 groups: 711 - admin: cosmos1.. 712 group_id: "1" 713 metadata: AQ== 714 total_weight: "3" 715 version: "1" 716 - admin: cosmos1.. 717 group_id: "2" 718 metadata: AQ== 719 total_weight: "3" 720 version: "1" 721 pagination: 722 next_key: null 723 total: "2" 724 ``` 725 726 ##### group-policies-by-group 727 728 The `group-policies-by-group` command allows users to query for group policies by group id with pagination flags. 729 730 ```bash 731 simd query group group-policies-by-group [group-id] [flags] 732 ``` 733 734 Example: 735 736 ```bash 737 simd query group group-policies-by-group 1 738 ``` 739 740 Example Output: 741 742 ```bash 743 group_policies: 744 - address: cosmos1.. 745 admin: cosmos1.. 746 decision_policy: 747 '@type': /cosmos.group.v1.ThresholdDecisionPolicy 748 threshold: "1" 749 windows: 750 min_execution_period: 0s 751 voting_period: 432000s 752 group_id: "1" 753 metadata: AQ== 754 version: "1" 755 - address: cosmos1.. 756 admin: cosmos1.. 757 decision_policy: 758 '@type': /cosmos.group.v1.ThresholdDecisionPolicy 759 threshold: "1" 760 windows: 761 min_execution_period: 0s 762 voting_period: 432000s 763 group_id: "1" 764 metadata: AQ== 765 version: "1" 766 pagination: 767 next_key: null 768 total: "2" 769 ``` 770 771 ##### group-policies-by-admin 772 773 The `group-policies-by-admin` command allows users to query for group policies by admin account address with pagination flags. 774 775 ```bash 776 simd query group group-policies-by-admin [admin] [flags] 777 ``` 778 779 Example: 780 781 ```bash 782 simd query group group-policies-by-admin cosmos1.. 783 ``` 784 785 Example Output: 786 787 ```bash 788 group_policies: 789 - address: cosmos1.. 790 admin: cosmos1.. 791 decision_policy: 792 '@type': /cosmos.group.v1.ThresholdDecisionPolicy 793 threshold: "1" 794 windows: 795 min_execution_period: 0s 796 voting_period: 432000s 797 group_id: "1" 798 metadata: AQ== 799 version: "1" 800 - address: cosmos1.. 801 admin: cosmos1.. 802 decision_policy: 803 '@type': /cosmos.group.v1.ThresholdDecisionPolicy 804 threshold: "1" 805 windows: 806 min_execution_period: 0s 807 voting_period: 432000s 808 group_id: "1" 809 metadata: AQ== 810 version: "1" 811 pagination: 812 next_key: null 813 total: "2" 814 ``` 815 816 ##### proposal 817 818 The `proposal` command allows users to query for proposal by id. 819 820 ```bash 821 simd query group proposal [id] [flags] 822 ``` 823 824 Example: 825 826 ```bash 827 simd query group proposal 1 828 ``` 829 830 Example Output: 831 832 ```bash 833 proposal: 834 address: cosmos1.. 835 executor_result: EXECUTOR_RESULT_NOT_RUN 836 group_policy_version: "1" 837 group_version: "1" 838 metadata: AQ== 839 msgs: 840 - '@type': /cosmos.bank.v1beta1.MsgSend 841 amount: 842 - amount: "100000000" 843 denom: stake 844 from_address: cosmos1.. 845 to_address: cosmos1.. 846 proposal_id: "1" 847 proposers: 848 - cosmos1.. 849 result: RESULT_UNFINALIZED 850 status: STATUS_SUBMITTED 851 submitted_at: "2021-12-17T07:06:26.310638964Z" 852 windows: 853 min_execution_period: 0s 854 voting_period: 432000s 855 vote_state: 856 abstain_count: "0" 857 no_count: "0" 858 veto_count: "0" 859 yes_count: "0" 860 summary: "Summary" 861 title: "Title" 862 ``` 863 864 ##### proposals-by-group-policy 865 866 The `proposals-by-group-policy` command allows users to query for proposals by account address of group policy with pagination flags. 867 868 ```bash 869 simd query group proposals-by-group-policy [group-policy-account] [flags] 870 ``` 871 872 Example: 873 874 ```bash 875 simd query group proposals-by-group-policy cosmos1.. 876 ``` 877 878 Example Output: 879 880 ```bash 881 pagination: 882 next_key: null 883 total: "1" 884 proposals: 885 - address: cosmos1.. 886 executor_result: EXECUTOR_RESULT_NOT_RUN 887 group_policy_version: "1" 888 group_version: "1" 889 metadata: AQ== 890 msgs: 891 - '@type': /cosmos.bank.v1beta1.MsgSend 892 amount: 893 - amount: "100000000" 894 denom: stake 895 from_address: cosmos1.. 896 to_address: cosmos1.. 897 proposal_id: "1" 898 proposers: 899 - cosmos1.. 900 result: RESULT_UNFINALIZED 901 status: STATUS_SUBMITTED 902 submitted_at: "2021-12-17T07:06:26.310638964Z" 903 windows: 904 min_execution_period: 0s 905 voting_period: 432000s 906 vote_state: 907 abstain_count: "0" 908 no_count: "0" 909 veto_count: "0" 910 yes_count: "0" 911 summary: "Summary" 912 title: "Title" 913 ``` 914 915 ##### vote 916 917 The `vote` command allows users to query for vote by proposal id and voter account address. 918 919 ```bash 920 simd query group vote [proposal-id] [voter] [flags] 921 ``` 922 923 Example: 924 925 ```bash 926 simd query group vote 1 cosmos1.. 927 ``` 928 929 Example Output: 930 931 ```bash 932 vote: 933 choice: CHOICE_YES 934 metadata: AQ== 935 proposal_id: "1" 936 submitted_at: "2021-12-17T08:05:02.490164009Z" 937 voter: cosmos1.. 938 ``` 939 940 ##### votes-by-proposal 941 942 The `votes-by-proposal` command allows users to query for votes by proposal id with pagination flags. 943 944 ```bash 945 simd query group votes-by-proposal [proposal-id] [flags] 946 ``` 947 948 Example: 949 950 ```bash 951 simd query group votes-by-proposal 1 952 ``` 953 954 Example Output: 955 956 ```bash 957 pagination: 958 next_key: null 959 total: "1" 960 votes: 961 - choice: CHOICE_YES 962 metadata: AQ== 963 proposal_id: "1" 964 submitted_at: "2021-12-17T08:05:02.490164009Z" 965 voter: cosmos1.. 966 ``` 967 968 ##### votes-by-voter 969 970 The `votes-by-voter` command allows users to query for votes by voter account address with pagination flags. 971 972 ```bash 973 simd query group votes-by-voter [voter] [flags] 974 ``` 975 976 Example: 977 978 ```bash 979 simd query group votes-by-voter cosmos1.. 980 ``` 981 982 Example Output: 983 984 ```bash 985 pagination: 986 next_key: null 987 total: "1" 988 votes: 989 - choice: CHOICE_YES 990 metadata: AQ== 991 proposal_id: "1" 992 submitted_at: "2021-12-17T08:05:02.490164009Z" 993 voter: cosmos1.. 994 ``` 995 996 ### Transactions 997 998 The `tx` commands allow users to interact with the `group` module. 999 1000 ```bash 1001 simd tx group --help 1002 ``` 1003 1004 #### create-group 1005 1006 The `create-group` command allows users to create a group which is an aggregation of member accounts with associated weights and 1007 an administrator account. 1008 1009 ```bash 1010 simd tx group create-group [admin] [metadata] [members-json-file] 1011 ``` 1012 1013 Example: 1014 1015 ```bash 1016 simd tx group create-group cosmos1.. "AQ==" members.json 1017 ``` 1018 1019 #### update-group-admin 1020 1021 The `update-group-admin` command allows users to update a group's admin. 1022 1023 ```bash 1024 simd tx group update-group-admin [admin] [group-id] [new-admin] [flags] 1025 ``` 1026 1027 Example: 1028 1029 ```bash 1030 simd tx group update-group-admin cosmos1.. 1 cosmos1.. 1031 ``` 1032 1033 #### update-group-members 1034 1035 The `update-group-members` command allows users to update a group's members. 1036 1037 ```bash 1038 simd tx group update-group-members [admin] [group-id] [members-json-file] [flags] 1039 ``` 1040 1041 Example: 1042 1043 ```bash 1044 simd tx group update-group-members cosmos1.. 1 members.json 1045 ``` 1046 1047 #### update-group-metadata 1048 1049 The `update-group-metadata` command allows users to update a group's metadata. 1050 1051 ```bash 1052 simd tx group update-group-metadata [admin] [group-id] [metadata] [flags] 1053 ``` 1054 1055 Example: 1056 1057 ```bash 1058 simd tx group update-group-metadata cosmos1.. 1 "AQ==" 1059 ``` 1060 1061 #### create-group-policy 1062 1063 The `create-group-policy` command allows users to create a group policy which is an account associated with a group and a decision policy. 1064 1065 ```bash 1066 simd tx group create-group-policy [admin] [group-id] [metadata] [decision-policy] [flags] 1067 ``` 1068 1069 Example: 1070 1071 ```bash 1072 simd tx group create-group-policy cosmos1.. 1 "AQ==" '{"@type":"/cosmos.group.v1.ThresholdDecisionPolicy", "threshold":"1", "windows": {"voting_period": "120h", "min_execution_period": "0s"}}' 1073 ``` 1074 1075 #### create-group-with-policy 1076 1077 The `create-group-with-policy` command allows users to create a group which is an aggregation of member accounts with associated weights and an administrator account with decision policy. If the `--group-policy-as-admin` flag is set to `true`, the group policy address becomes the group and group policy admin. 1078 1079 ```bash 1080 simd tx group create-group-with-policy [admin] [group-metadata] [group-policy-metadata] [members-json-file] [decision-policy] [flags] 1081 ``` 1082 1083 Example: 1084 1085 ```bash 1086 simd tx group create-group-with-policy cosmos1.. "AQ==" "AQ==" members.json '{"@type":"/cosmos.group.v1.ThresholdDecisionPolicy", "threshold":"1", "windows": {"voting_period": "120h", "min_execution_period": "0s"}}' 1087 ``` 1088 1089 #### update-group-policy-admin 1090 1091 The `update-group-policy-admin` command allows users to update a group policy admin. 1092 1093 ```bash 1094 simd tx group update-group-policy-admin [admin] [group-policy-account] [new-admin] [flags] 1095 ``` 1096 1097 Example: 1098 1099 ```bash 1100 simd tx group update-group-policy-admin cosmos1.. cosmos1.. cosmos1.. 1101 ``` 1102 1103 #### update-group-policy-metadata 1104 1105 The `update-group-policy-metadata` command allows users to update a group policy metadata. 1106 1107 ```bash 1108 simd tx group update-group-policy-metadata [admin] [group-policy-account] [new-metadata] [flags] 1109 ``` 1110 1111 Example: 1112 1113 ```bash 1114 simd tx group update-group-policy-metadata cosmos1.. cosmos1.. "AQ==" 1115 ``` 1116 1117 #### update-group-policy-decision-policy 1118 1119 The `update-group-policy-decision-policy` command allows users to update a group policy's decision policy. 1120 1121 ```bash 1122 simd tx group update-group-policy-decision-policy [admin] [group-policy-account] [decision-policy] [flags] 1123 ``` 1124 1125 Example: 1126 1127 ```bash 1128 simd tx group update-group-policy-decision-policy cosmos1.. cosmos1.. '{"@type":"/cosmos.group.v1.ThresholdDecisionPolicy", "threshold":"2", "windows": {"voting_period": "120h", "min_execution_period": "0s"}}' 1129 ``` 1130 1131 #### submit-proposal 1132 1133 The `submit-proposal` command allows users to submit a new proposal. 1134 1135 ```bash 1136 simd tx group submit-proposal [group-policy-account] [proposer[,proposer]*] [msg_tx_json_file] [metadata] [flags] 1137 ``` 1138 1139 Example: 1140 1141 ```bash 1142 simd tx group submit-proposal cosmos1.. cosmos1.. msg_tx.json "AQ==" 1143 ``` 1144 1145 #### withdraw-proposal 1146 1147 The `withdraw-proposal` command allows users to withdraw a proposal. 1148 1149 ```bash 1150 simd tx group withdraw-proposal [proposal-id] [group-policy-admin-or-proposer] 1151 ``` 1152 1153 Example: 1154 1155 ```bash 1156 simd tx group withdraw-proposal 1 cosmos1.. 1157 ``` 1158 1159 #### vote 1160 1161 The `vote` command allows users to vote on a proposal. 1162 1163 ```bash 1164 simd tx group vote proposal-id] [voter] [choice] [metadata] [flags] 1165 ``` 1166 1167 Example: 1168 1169 ```bash 1170 simd tx group vote 1 cosmos1.. CHOICE_YES "AQ==" 1171 ``` 1172 1173 #### exec 1174 1175 The `exec` command allows users to execute a proposal. 1176 1177 ```bash 1178 simd tx group exec [proposal-id] [flags] 1179 ``` 1180 1181 Example: 1182 1183 ```bash 1184 simd tx group exec 1 1185 ``` 1186 1187 #### leave-group 1188 1189 The `leave-group` command allows group member to leave the group. 1190 1191 ```bash 1192 simd tx group leave-group [member-address] [group-id] 1193 ``` 1194 1195 Example: 1196 1197 ```bash 1198 simd tx group leave-group cosmos1... 1 1199 ``` 1200 1201 ### gRPC 1202 1203 A user can query the `group` module using gRPC endpoints. 1204 1205 #### GroupInfo 1206 1207 The `GroupInfo` endpoint allows users to query for group info by given group id. 1208 1209 ```bash 1210 cosmos.group.v1.Query/GroupInfo 1211 ``` 1212 1213 Example: 1214 1215 ```bash 1216 grpcurl -plaintext \ 1217 -d '{"group_id":1}' localhost:9090 cosmos.group.v1.Query/GroupInfo 1218 ``` 1219 1220 Example Output: 1221 1222 ```bash 1223 { 1224 "info": { 1225 "groupId": "1", 1226 "admin": "cosmos1..", 1227 "metadata": "AQ==", 1228 "version": "1", 1229 "totalWeight": "3" 1230 } 1231 } 1232 ``` 1233 1234 #### GroupPolicyInfo 1235 1236 The `GroupPolicyInfo` endpoint allows users to query for group policy info by account address of group policy. 1237 1238 ```bash 1239 cosmos.group.v1.Query/GroupPolicyInfo 1240 ``` 1241 1242 Example: 1243 1244 ```bash 1245 grpcurl -plaintext \ 1246 -d '{"address":"cosmos1.."}' localhost:9090 cosmos.group.v1.Query/GroupPolicyInfo 1247 ``` 1248 1249 Example Output: 1250 1251 ```bash 1252 { 1253 "info": { 1254 "address": "cosmos1..", 1255 "groupId": "1", 1256 "admin": "cosmos1..", 1257 "version": "1", 1258 "decisionPolicy": {"@type":"/cosmos.group.v1.ThresholdDecisionPolicy","threshold":"1","windows": {"voting_period": "120h", "min_execution_period": "0s"}}, 1259 } 1260 } 1261 ``` 1262 1263 #### GroupMembers 1264 1265 The `GroupMembers` endpoint allows users to query for group members by group id with pagination flags. 1266 1267 ```bash 1268 cosmos.group.v1.Query/GroupMembers 1269 ``` 1270 1271 Example: 1272 1273 ```bash 1274 grpcurl -plaintext \ 1275 -d '{"group_id":"1"}' localhost:9090 cosmos.group.v1.Query/GroupMembers 1276 ``` 1277 1278 Example Output: 1279 1280 ```bash 1281 { 1282 "members": [ 1283 { 1284 "groupId": "1", 1285 "member": { 1286 "address": "cosmos1..", 1287 "weight": "1" 1288 } 1289 }, 1290 { 1291 "groupId": "1", 1292 "member": { 1293 "address": "cosmos1..", 1294 "weight": "2" 1295 } 1296 } 1297 ], 1298 "pagination": { 1299 "total": "2" 1300 } 1301 } 1302 ``` 1303 1304 #### GroupsByAdmin 1305 1306 The `GroupsByAdmin` endpoint allows users to query for groups by admin account address with pagination flags. 1307 1308 ```bash 1309 cosmos.group.v1.Query/GroupsByAdmin 1310 ``` 1311 1312 Example: 1313 1314 ```bash 1315 grpcurl -plaintext \ 1316 -d '{"admin":"cosmos1.."}' localhost:9090 cosmos.group.v1.Query/GroupsByAdmin 1317 ``` 1318 1319 Example Output: 1320 1321 ```bash 1322 { 1323 "groups": [ 1324 { 1325 "groupId": "1", 1326 "admin": "cosmos1..", 1327 "metadata": "AQ==", 1328 "version": "1", 1329 "totalWeight": "3" 1330 }, 1331 { 1332 "groupId": "2", 1333 "admin": "cosmos1..", 1334 "metadata": "AQ==", 1335 "version": "1", 1336 "totalWeight": "3" 1337 } 1338 ], 1339 "pagination": { 1340 "total": "2" 1341 } 1342 } 1343 ``` 1344 1345 #### GroupPoliciesByGroup 1346 1347 The `GroupPoliciesByGroup` endpoint allows users to query for group policies by group id with pagination flags. 1348 1349 ```bash 1350 cosmos.group.v1.Query/GroupPoliciesByGroup 1351 ``` 1352 1353 Example: 1354 1355 ```bash 1356 grpcurl -plaintext \ 1357 -d '{"group_id":"1"}' localhost:9090 cosmos.group.v1.Query/GroupPoliciesByGroup 1358 ``` 1359 1360 Example Output: 1361 1362 ```bash 1363 { 1364 "GroupPolicies": [ 1365 { 1366 "address": "cosmos1..", 1367 "groupId": "1", 1368 "admin": "cosmos1..", 1369 "version": "1", 1370 "decisionPolicy": {"@type":"/cosmos.group.v1.ThresholdDecisionPolicy","threshold":"1","windows":{"voting_period": "120h", "min_execution_period": "0s"}}, 1371 }, 1372 { 1373 "address": "cosmos1..", 1374 "groupId": "1", 1375 "admin": "cosmos1..", 1376 "version": "1", 1377 "decisionPolicy": {"@type":"/cosmos.group.v1.ThresholdDecisionPolicy","threshold":"1","windows":{"voting_period": "120h", "min_execution_period": "0s"}}, 1378 } 1379 ], 1380 "pagination": { 1381 "total": "2" 1382 } 1383 } 1384 ``` 1385 1386 #### GroupPoliciesByAdmin 1387 1388 The `GroupPoliciesByAdmin` endpoint allows users to query for group policies by admin account address with pagination flags. 1389 1390 ```bash 1391 cosmos.group.v1.Query/GroupPoliciesByAdmin 1392 ``` 1393 1394 Example: 1395 1396 ```bash 1397 grpcurl -plaintext \ 1398 -d '{"admin":"cosmos1.."}' localhost:9090 cosmos.group.v1.Query/GroupPoliciesByAdmin 1399 ``` 1400 1401 Example Output: 1402 1403 ```bash 1404 { 1405 "GroupPolicies": [ 1406 { 1407 "address": "cosmos1..", 1408 "groupId": "1", 1409 "admin": "cosmos1..", 1410 "version": "1", 1411 "decisionPolicy": {"@type":"/cosmos.group.v1.ThresholdDecisionPolicy","threshold":"1","windows":{"voting_period": "120h", "min_execution_period": "0s"}}, 1412 }, 1413 { 1414 "address": "cosmos1..", 1415 "groupId": "1", 1416 "admin": "cosmos1..", 1417 "version": "1", 1418 "decisionPolicy": {"@type":"/cosmos.group.v1.ThresholdDecisionPolicy","threshold":"1","windows":{"voting_period": "120h", "min_execution_period": "0s"}}, 1419 } 1420 ], 1421 "pagination": { 1422 "total": "2" 1423 } 1424 } 1425 ``` 1426 1427 #### Proposal 1428 1429 The `Proposal` endpoint allows users to query for proposal by id. 1430 1431 ```bash 1432 cosmos.group.v1.Query/Proposal 1433 ``` 1434 1435 Example: 1436 1437 ```bash 1438 grpcurl -plaintext \ 1439 -d '{"proposal_id":"1"}' localhost:9090 cosmos.group.v1.Query/Proposal 1440 ``` 1441 1442 Example Output: 1443 1444 ```bash 1445 { 1446 "proposal": { 1447 "proposalId": "1", 1448 "address": "cosmos1..", 1449 "proposers": [ 1450 "cosmos1.." 1451 ], 1452 "submittedAt": "2021-12-17T07:06:26.310638964Z", 1453 "groupVersion": "1", 1454 "GroupPolicyVersion": "1", 1455 "status": "STATUS_SUBMITTED", 1456 "result": "RESULT_UNFINALIZED", 1457 "voteState": { 1458 "yesCount": "0", 1459 "noCount": "0", 1460 "abstainCount": "0", 1461 "vetoCount": "0" 1462 }, 1463 "windows": { 1464 "min_execution_period": "0s", 1465 "voting_period": "432000s" 1466 }, 1467 "executorResult": "EXECUTOR_RESULT_NOT_RUN", 1468 "messages": [ 1469 {"@type":"/cosmos.bank.v1beta1.MsgSend","amount":[{"denom":"stake","amount":"100000000"}],"fromAddress":"cosmos1..","toAddress":"cosmos1.."} 1470 ], 1471 "title": "Title", 1472 "summary": "Summary", 1473 } 1474 } 1475 ``` 1476 1477 #### ProposalsByGroupPolicy 1478 1479 The `ProposalsByGroupPolicy` endpoint allows users to query for proposals by account address of group policy with pagination flags. 1480 1481 ```bash 1482 cosmos.group.v1.Query/ProposalsByGroupPolicy 1483 ``` 1484 1485 Example: 1486 1487 ```bash 1488 grpcurl -plaintext \ 1489 -d '{"address":"cosmos1.."}' localhost:9090 cosmos.group.v1.Query/ProposalsByGroupPolicy 1490 ``` 1491 1492 Example Output: 1493 1494 ```bash 1495 { 1496 "proposals": [ 1497 { 1498 "proposalId": "1", 1499 "address": "cosmos1..", 1500 "proposers": [ 1501 "cosmos1.." 1502 ], 1503 "submittedAt": "2021-12-17T08:03:27.099649352Z", 1504 "groupVersion": "1", 1505 "GroupPolicyVersion": "1", 1506 "status": "STATUS_CLOSED", 1507 "result": "RESULT_ACCEPTED", 1508 "voteState": { 1509 "yesCount": "1", 1510 "noCount": "0", 1511 "abstainCount": "0", 1512 "vetoCount": "0" 1513 }, 1514 "windows": { 1515 "min_execution_period": "0s", 1516 "voting_period": "432000s" 1517 }, 1518 "executorResult": "EXECUTOR_RESULT_NOT_RUN", 1519 "messages": [ 1520 {"@type":"/cosmos.bank.v1beta1.MsgSend","amount":[{"denom":"stake","amount":"100000000"}],"fromAddress":"cosmos1..","toAddress":"cosmos1.."} 1521 ], 1522 "title": "Title", 1523 "summary": "Summary", 1524 } 1525 ], 1526 "pagination": { 1527 "total": "1" 1528 } 1529 } 1530 ``` 1531 1532 #### VoteByProposalVoter 1533 1534 The `VoteByProposalVoter` endpoint allows users to query for vote by proposal id and voter account address. 1535 1536 ```bash 1537 cosmos.group.v1.Query/VoteByProposalVoter 1538 ``` 1539 1540 Example: 1541 1542 ```bash 1543 grpcurl -plaintext \ 1544 -d '{"proposal_id":"1","voter":"cosmos1.."}' localhost:9090 cosmos.group.v1.Query/VoteByProposalVoter 1545 ``` 1546 1547 Example Output: 1548 1549 ```bash 1550 { 1551 "vote": { 1552 "proposalId": "1", 1553 "voter": "cosmos1..", 1554 "choice": "CHOICE_YES", 1555 "submittedAt": "2021-12-17T08:05:02.490164009Z" 1556 } 1557 } 1558 ``` 1559 1560 #### VotesByProposal 1561 1562 The `VotesByProposal` endpoint allows users to query for votes by proposal id with pagination flags. 1563 1564 ```bash 1565 cosmos.group.v1.Query/VotesByProposal 1566 ``` 1567 1568 Example: 1569 1570 ```bash 1571 grpcurl -plaintext \ 1572 -d '{"proposal_id":"1"}' localhost:9090 cosmos.group.v1.Query/VotesByProposal 1573 ``` 1574 1575 Example Output: 1576 1577 ```bash 1578 { 1579 "votes": [ 1580 { 1581 "proposalId": "1", 1582 "voter": "cosmos1..", 1583 "choice": "CHOICE_YES", 1584 "submittedAt": "2021-12-17T08:05:02.490164009Z" 1585 } 1586 ], 1587 "pagination": { 1588 "total": "1" 1589 } 1590 } 1591 ``` 1592 1593 #### VotesByVoter 1594 1595 The `VotesByVoter` endpoint allows users to query for votes by voter account address with pagination flags. 1596 1597 ```bash 1598 cosmos.group.v1.Query/VotesByVoter 1599 ``` 1600 1601 Example: 1602 1603 ```bash 1604 grpcurl -plaintext \ 1605 -d '{"voter":"cosmos1.."}' localhost:9090 cosmos.group.v1.Query/VotesByVoter 1606 ``` 1607 1608 Example Output: 1609 1610 ```bash 1611 { 1612 "votes": [ 1613 { 1614 "proposalId": "1", 1615 "voter": "cosmos1..", 1616 "choice": "CHOICE_YES", 1617 "submittedAt": "2021-12-17T08:05:02.490164009Z" 1618 } 1619 ], 1620 "pagination": { 1621 "total": "1" 1622 } 1623 } 1624 ``` 1625 1626 ### REST 1627 1628 A user can query the `group` module using REST endpoints. 1629 1630 #### GroupInfo 1631 1632 The `GroupInfo` endpoint allows users to query for group info by given group id. 1633 1634 ```bash 1635 /cosmos/group/v1/group_info/{group_id} 1636 ``` 1637 1638 Example: 1639 1640 ```bash 1641 curl localhost:1317/cosmos/group/v1/group_info/1 1642 ``` 1643 1644 Example Output: 1645 1646 ```bash 1647 { 1648 "info": { 1649 "id": "1", 1650 "admin": "cosmos1..", 1651 "metadata": "AQ==", 1652 "version": "1", 1653 "total_weight": "3" 1654 } 1655 } 1656 ``` 1657 1658 #### GroupPolicyInfo 1659 1660 The `GroupPolicyInfo` endpoint allows users to query for group policy info by account address of group policy. 1661 1662 ```bash 1663 /cosmos/group/v1/group_policy_info/{address} 1664 ``` 1665 1666 Example: 1667 1668 ```bash 1669 curl localhost:1317/cosmos/group/v1/group_policy_info/cosmos1.. 1670 ``` 1671 1672 Example Output: 1673 1674 ```bash 1675 { 1676 "info": { 1677 "address": "cosmos1..", 1678 "group_id": "1", 1679 "admin": "cosmos1..", 1680 "metadata": "AQ==", 1681 "version": "1", 1682 "decision_policy": { 1683 "@type": "/cosmos.group.v1.ThresholdDecisionPolicy", 1684 "threshold": "1", 1685 "windows": { 1686 "voting_period": "120h", 1687 "min_execution_period": "0s" 1688 } 1689 }, 1690 } 1691 } 1692 ``` 1693 1694 #### GroupMembers 1695 1696 The `GroupMembers` endpoint allows users to query for group members by group id with pagination flags. 1697 1698 ```bash 1699 /cosmos/group/v1/group_members/{group_id} 1700 ``` 1701 1702 Example: 1703 1704 ```bash 1705 curl localhost:1317/cosmos/group/v1/group_members/1 1706 ``` 1707 1708 Example Output: 1709 1710 ```bash 1711 { 1712 "members": [ 1713 { 1714 "group_id": "1", 1715 "member": { 1716 "address": "cosmos1..", 1717 "weight": "1", 1718 "metadata": "AQ==" 1719 } 1720 }, 1721 { 1722 "group_id": "1", 1723 "member": { 1724 "address": "cosmos1..", 1725 "weight": "2", 1726 "metadata": "AQ==" 1727 } 1728 ], 1729 "pagination": { 1730 "next_key": null, 1731 "total": "2" 1732 } 1733 } 1734 ``` 1735 1736 #### GroupsByAdmin 1737 1738 The `GroupsByAdmin` endpoint allows users to query for groups by admin account address with pagination flags. 1739 1740 ```bash 1741 /cosmos/group/v1/groups_by_admin/{admin} 1742 ``` 1743 1744 Example: 1745 1746 ```bash 1747 curl localhost:1317/cosmos/group/v1/groups_by_admin/cosmos1.. 1748 ``` 1749 1750 Example Output: 1751 1752 ```bash 1753 { 1754 "groups": [ 1755 { 1756 "id": "1", 1757 "admin": "cosmos1..", 1758 "metadata": "AQ==", 1759 "version": "1", 1760 "total_weight": "3" 1761 }, 1762 { 1763 "id": "2", 1764 "admin": "cosmos1..", 1765 "metadata": "AQ==", 1766 "version": "1", 1767 "total_weight": "3" 1768 } 1769 ], 1770 "pagination": { 1771 "next_key": null, 1772 "total": "2" 1773 } 1774 } 1775 ``` 1776 1777 #### GroupPoliciesByGroup 1778 1779 The `GroupPoliciesByGroup` endpoint allows users to query for group policies by group id with pagination flags. 1780 1781 ```bash 1782 /cosmos/group/v1/group_policies_by_group/{group_id} 1783 ``` 1784 1785 Example: 1786 1787 ```bash 1788 curl localhost:1317/cosmos/group/v1/group_policies_by_group/1 1789 ``` 1790 1791 Example Output: 1792 1793 ```bash 1794 { 1795 "group_policies": [ 1796 { 1797 "address": "cosmos1..", 1798 "group_id": "1", 1799 "admin": "cosmos1..", 1800 "metadata": "AQ==", 1801 "version": "1", 1802 "decision_policy": { 1803 "@type": "/cosmos.group.v1.ThresholdDecisionPolicy", 1804 "threshold": "1", 1805 "windows": { 1806 "voting_period": "120h", 1807 "min_execution_period": "0s" 1808 } 1809 }, 1810 }, 1811 { 1812 "address": "cosmos1..", 1813 "group_id": "1", 1814 "admin": "cosmos1..", 1815 "metadata": "AQ==", 1816 "version": "1", 1817 "decision_policy": { 1818 "@type": "/cosmos.group.v1.ThresholdDecisionPolicy", 1819 "threshold": "1", 1820 "windows": { 1821 "voting_period": "120h", 1822 "min_execution_period": "0s" 1823 } 1824 }, 1825 } 1826 ], 1827 "pagination": { 1828 "next_key": null, 1829 "total": "2" 1830 } 1831 } 1832 ``` 1833 1834 #### GroupPoliciesByAdmin 1835 1836 The `GroupPoliciesByAdmin` endpoint allows users to query for group policies by admin account address with pagination flags. 1837 1838 ```bash 1839 /cosmos/group/v1/group_policies_by_admin/{admin} 1840 ``` 1841 1842 Example: 1843 1844 ```bash 1845 curl localhost:1317/cosmos/group/v1/group_policies_by_admin/cosmos1.. 1846 ``` 1847 1848 Example Output: 1849 1850 ```bash 1851 { 1852 "group_policies": [ 1853 { 1854 "address": "cosmos1..", 1855 "group_id": "1", 1856 "admin": "cosmos1..", 1857 "metadata": "AQ==", 1858 "version": "1", 1859 "decision_policy": { 1860 "@type": "/cosmos.group.v1.ThresholdDecisionPolicy", 1861 "threshold": "1", 1862 "windows": { 1863 "voting_period": "120h", 1864 "min_execution_period": "0s" 1865 } 1866 }, 1867 }, 1868 { 1869 "address": "cosmos1..", 1870 "group_id": "1", 1871 "admin": "cosmos1..", 1872 "metadata": "AQ==", 1873 "version": "1", 1874 "decision_policy": { 1875 "@type": "/cosmos.group.v1.ThresholdDecisionPolicy", 1876 "threshold": "1", 1877 "windows": { 1878 "voting_period": "120h", 1879 "min_execution_period": "0s" 1880 } 1881 }, 1882 } 1883 ], 1884 "pagination": { 1885 "next_key": null, 1886 "total": "2" 1887 } 1888 ``` 1889 1890 #### Proposal 1891 1892 The `Proposal` endpoint allows users to query for proposal by id. 1893 1894 ```bash 1895 /cosmos/group/v1/proposal/{proposal_id} 1896 ``` 1897 1898 Example: 1899 1900 ```bash 1901 curl localhost:1317/cosmos/group/v1/proposal/1 1902 ``` 1903 1904 Example Output: 1905 1906 ```bash 1907 { 1908 "proposal": { 1909 "proposal_id": "1", 1910 "address": "cosmos1..", 1911 "metadata": "AQ==", 1912 "proposers": [ 1913 "cosmos1.." 1914 ], 1915 "submitted_at": "2021-12-17T07:06:26.310638964Z", 1916 "group_version": "1", 1917 "group_policy_version": "1", 1918 "status": "STATUS_SUBMITTED", 1919 "result": "RESULT_UNFINALIZED", 1920 "vote_state": { 1921 "yes_count": "0", 1922 "no_count": "0", 1923 "abstain_count": "0", 1924 "veto_count": "0" 1925 }, 1926 "windows": { 1927 "min_execution_period": "0s", 1928 "voting_period": "432000s" 1929 }, 1930 "executor_result": "EXECUTOR_RESULT_NOT_RUN", 1931 "messages": [ 1932 { 1933 "@type": "/cosmos.bank.v1beta1.MsgSend", 1934 "from_address": "cosmos1..", 1935 "to_address": "cosmos1..", 1936 "amount": [ 1937 { 1938 "denom": "stake", 1939 "amount": "100000000" 1940 } 1941 ] 1942 } 1943 ], 1944 "title": "Title", 1945 "summary": "Summary", 1946 } 1947 } 1948 ``` 1949 1950 #### ProposalsByGroupPolicy 1951 1952 The `ProposalsByGroupPolicy` endpoint allows users to query for proposals by account address of group policy with pagination flags. 1953 1954 ```bash 1955 /cosmos/group/v1/proposals_by_group_policy/{address} 1956 ``` 1957 1958 Example: 1959 1960 ```bash 1961 curl localhost:1317/cosmos/group/v1/proposals_by_group_policy/cosmos1.. 1962 ``` 1963 1964 Example Output: 1965 1966 ```bash 1967 { 1968 "proposals": [ 1969 { 1970 "id": "1", 1971 "group_policy_address": "cosmos1..", 1972 "metadata": "AQ==", 1973 "proposers": [ 1974 "cosmos1.." 1975 ], 1976 "submit_time": "2021-12-17T08:03:27.099649352Z", 1977 "group_version": "1", 1978 "group_policy_version": "1", 1979 "status": "STATUS_CLOSED", 1980 "result": "RESULT_ACCEPTED", 1981 "vote_state": { 1982 "yes_count": "1", 1983 "no_count": "0", 1984 "abstain_count": "0", 1985 "veto_count": "0" 1986 }, 1987 "windows": { 1988 "min_execution_period": "0s", 1989 "voting_period": "432000s" 1990 }, 1991 "executor_result": "EXECUTOR_RESULT_NOT_RUN", 1992 "messages": [ 1993 { 1994 "@type": "/cosmos.bank.v1beta1.MsgSend", 1995 "from_address": "cosmos1..", 1996 "to_address": "cosmos1..", 1997 "amount": [ 1998 { 1999 "denom": "stake", 2000 "amount": "100000000" 2001 } 2002 ] 2003 } 2004 ] 2005 } 2006 ], 2007 "pagination": { 2008 "next_key": null, 2009 "total": "1" 2010 } 2011 } 2012 ``` 2013 2014 #### VoteByProposalVoter 2015 2016 The `VoteByProposalVoter` endpoint allows users to query for vote by proposal id and voter account address. 2017 2018 ```bash 2019 /cosmos/group/v1/vote_by_proposal_voter/{proposal_id}/{voter} 2020 ``` 2021 2022 Example: 2023 2024 ```bash 2025 curl localhost:1317/cosmos/group/v1beta1/vote_by_proposal_voter/1/cosmos1.. 2026 ``` 2027 2028 Example Output: 2029 2030 ```bash 2031 { 2032 "vote": { 2033 "proposal_id": "1", 2034 "voter": "cosmos1..", 2035 "choice": "CHOICE_YES", 2036 "metadata": "AQ==", 2037 "submitted_at": "2021-12-17T08:05:02.490164009Z" 2038 } 2039 } 2040 ``` 2041 2042 #### VotesByProposal 2043 2044 The `VotesByProposal` endpoint allows users to query for votes by proposal id with pagination flags. 2045 2046 ```bash 2047 /cosmos/group/v1/votes_by_proposal/{proposal_id} 2048 ``` 2049 2050 Example: 2051 2052 ```bash 2053 curl localhost:1317/cosmos/group/v1/votes_by_proposal/1 2054 ``` 2055 2056 Example Output: 2057 2058 ```bash 2059 { 2060 "votes": [ 2061 { 2062 "proposal_id": "1", 2063 "voter": "cosmos1..", 2064 "option": "CHOICE_YES", 2065 "metadata": "AQ==", 2066 "submit_time": "2021-12-17T08:05:02.490164009Z" 2067 } 2068 ], 2069 "pagination": { 2070 "next_key": null, 2071 "total": "1" 2072 } 2073 } 2074 ``` 2075 2076 #### VotesByVoter 2077 2078 The `VotesByVoter` endpoint allows users to query for votes by voter account address with pagination flags. 2079 2080 ```bash 2081 /cosmos/group/v1/votes_by_voter/{voter} 2082 ``` 2083 2084 Example: 2085 2086 ```bash 2087 curl localhost:1317/cosmos/group/v1/votes_by_voter/cosmos1.. 2088 ``` 2089 2090 Example Output: 2091 2092 ```bash 2093 { 2094 "votes": [ 2095 { 2096 "proposal_id": "1", 2097 "voter": "cosmos1..", 2098 "choice": "CHOICE_YES", 2099 "metadata": "AQ==", 2100 "submitted_at": "2021-12-17T08:05:02.490164009Z" 2101 } 2102 ], 2103 "pagination": { 2104 "next_key": null, 2105 "total": "1" 2106 } 2107 } 2108 ``` 2109 2110 ## Metadata 2111 2112 The group module has four locations for metadata where users can provide further context about the on-chain actions they are taking. By default all metadata fields have a 255 character length field where metadata can be stored in json format, either on-chain or off-chain depending on the amount of data required. Here we provide a recommendation for the json structure and where the data should be stored. There are two important factors in making these recommendations. First, that the group and gov modules are consistent with one another, note the number of proposals made by all groups may be quite large. Second, that client applications such as block explorers and governance interfaces have confidence in the consistency of metadata structure across chains. 2113 2114 ### Proposal 2115 2116 Location: off-chain as json object stored on IPFS (mirrors [gov proposal](../gov/README.md#metadata)) 2117 2118 ```json 2119 { 2120 "title": "", 2121 "authors": [""], 2122 "summary": "", 2123 "details": "", 2124 "proposal_forum_url": "", 2125 "vote_option_context": "", 2126 } 2127 ``` 2128 2129 :::note 2130 The `authors` field is an array of strings, this is to allow for multiple authors to be listed in the metadata. 2131 In v0.46, the `authors` field is a comma-separated string. Frontends are encouraged to support both formats for backwards compatibility. 2132 ::: 2133 2134 ### Vote 2135 2136 Location: on-chain as json within 255 character limit (mirrors [gov vote](../gov/README.md#metadata)) 2137 2138 ```json 2139 { 2140 "justification": "", 2141 } 2142 ``` 2143 2144 ### Group 2145 2146 Location: off-chain as json object stored on IPFS 2147 2148 ```json 2149 { 2150 "name": "", 2151 "description": "", 2152 "group_website_url": "", 2153 "group_forum_url": "", 2154 } 2155 ``` 2156 2157 ### Decision policy 2158 2159 Location: on-chain as json within 255 character limit 2160 2161 ```json 2162 { 2163 "name": "", 2164 "description": "", 2165 } 2166 ```