distribution
The distribution
module is responsible for fee distribution, and staking token provision distribution. This simple distribution mechanism describes a functional way to passively distribute rewards between validators and delegators. Note that this mechanism does not distribute funds as precisely as active reward distribution mechanisms and can be upgraded in the future.
For more information, visit https://docs.cosmos.network/main/modules/distribution/
Message Types
Msg
defines the distribution Msg service.
_17 // SetWithdrawAddress defines a method to change the withdraw address
_17 // for a delegator (or validator self-delegation).
_17 rpc SetWithdrawAddress(MsgSetWithdrawAddress) returns (MsgSetWithdrawAddressResponse);
_17 // WithdrawDelegatorReward defines a method to withdraw rewards of delegator
_17 // from a single validator.
_17 rpc WithdrawDelegatorReward(MsgWithdrawDelegatorReward) returns (MsgWithdrawDelegatorRewardResponse);
_17 // WithdrawValidatorCommission defines a method to withdraw the
_17 // full commission to the validator address.
_17 rpc WithdrawValidatorCommission(MsgWithdrawValidatorCommission) returns (MsgWithdrawValidatorCommissionResponse);
_17 // FundCommunityPool defines a method to allow an account to directly
_17 // fund the community pool.
_17 rpc FundCommunityPool(MsgFundCommunityPool) returns (MsgFundCommunityPoolResponse);
MsgSetWithdrawAddress
MsgSetWithdrawAddress
sets the withdraw address for a delegator (or validator self-delegation).
_9message MsgSetWithdrawAddress {
_9 option (cosmos.msg.v1.signer) = "delegator_address";
_9 option (gogoproto.equal) = false;
_9 option (gogoproto.goproto_getters) = false;
_9 string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_9 string withdraw_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
MsgSetWithdrawAddressResponse
MsgSetWithdrawAddressResponse
defines the Msg/SetWithdrawAddress
response type.
_1message MsgSetWithdrawAddressResponse {}
MsgWithdrawDelegatorReward
MsgWithdrawDelegatorReward
represents delegation withdrawal to a delegator from a single validator.
_9message MsgWithdrawDelegatorReward {
_9 option (cosmos.msg.v1.signer) = "delegator_address";
_9 option (gogoproto.equal) = false;
_9 option (gogoproto.goproto_getters) = false;
_9 string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_9 string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
MsgWithdrawDelegatorRewardResponse
MsgWithdrawDelegatorRewardResponse
defines the Msg/WithdrawDelegatorReward
response type.
_5message MsgWithdrawDelegatorRewardResponse {
_5 // Since: cosmos-sdk 0.46
_5 repeated cosmos.base.v1beta1.Coin amount = 1
_5 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
MsgWithdrawValidatorCommission
MsgWithdrawValidatorCommission
withdraws the full commission to the validator address.
_8message MsgWithdrawValidatorCommission {
_8 option (cosmos.msg.v1.signer) = "validator_address";
_8 option (gogoproto.equal) = false;
_8 option (gogoproto.goproto_getters) = false;
_8 string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
MsgWithdrawValidatorCommissionResponse
MsgWithdrawValidatorCommissionResponse
defines the Msg/WithdrawValidatorCommission
response type.
_5message MsgWithdrawValidatorCommissionResponse {
_5 // Since: cosmos-sdk 0.46
_5 repeated cosmos.base.v1beta1.Coin amount = 1
_5 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
MsgFundCommunityPool
allows an account to directly fund the community pool.
_10message MsgFundCommunityPool {
_10 option (cosmos.msg.v1.signer) = "depositor";
_10 option (gogoproto.equal) = false;
_10 option (gogoproto.goproto_getters) = false;
_10 repeated cosmos.base.v1beta1.Coin amount = 1
_10 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
_10 string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
MsgFundCommunityPoolResponse
defines the Msg/FundCommunityPool
response type.
_1message MsgFundCommunityPoolResponse {}
Queries
Query
defines the gRPC querier service for distribution module.
_53 // Params queries params of the distribution module.
_53 rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
_53 option (google.api.http).get = "/cosmos/distribution/v1beta1/params";
_53 // ValidatorOutstandingRewards queries rewards of a validator address.
_53 rpc ValidatorOutstandingRewards(QueryValidatorOutstandingRewardsRequest)
_53 returns (QueryValidatorOutstandingRewardsResponse) {
_53 option (google.api.http).get = "/cosmos/distribution/v1beta1/validators/"
_53 "{validator_address}/outstanding_rewards";
_53 // ValidatorCommission queries accumulated commission for a validator.
_53 rpc ValidatorCommission(QueryValidatorCommissionRequest) returns (QueryValidatorCommissionResponse) {
_53 option (google.api.http).get = "/cosmos/distribution/v1beta1/validators/"
_53 "{validator_address}/commission";
_53 // ValidatorSlashes queries slash events of a validator.
_53 rpc ValidatorSlashes(QueryValidatorSlashesRequest) returns (QueryValidatorSlashesResponse) {
_53 option (google.api.http).get = "/cosmos/distribution/v1beta1/validators/{validator_address}/slashes";
_53 // DelegationRewards queries the total rewards accrued by a delegation.
_53 rpc DelegationRewards(QueryDelegationRewardsRequest) returns (QueryDelegationRewardsResponse) {
_53 option (google.api.http).get = "/cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards/"
_53 "{validator_address}";
_53 // DelegationTotalRewards queries the total rewards accrued by a each
_53 rpc DelegationTotalRewards(QueryDelegationTotalRewardsRequest) returns (QueryDelegationTotalRewardsResponse) {
_53 option (google.api.http).get = "/cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards";
_53 // DelegatorValidators queries the validators of a delegator.
_53 rpc DelegatorValidators(QueryDelegatorValidatorsRequest) returns (QueryDelegatorValidatorsResponse) {
_53 option (google.api.http).get = "/cosmos/distribution/v1beta1/delegators/"
_53 "{delegator_address}/validators";
_53 // DelegatorWithdrawAddress queries withdraw address of a delegator.
_53 rpc DelegatorWithdrawAddress(QueryDelegatorWithdrawAddressRequest) returns (QueryDelegatorWithdrawAddressResponse) {
_53 option (google.api.http).get = "/cosmos/distribution/v1beta1/delegators/"
_53 "{delegator_address}/withdraw_address";
_53 // CommunityPool queries the community pool coins.
_53 rpc CommunityPool(QueryCommunityPoolRequest) returns (QueryCommunityPoolResponse) {
_53 option (google.api.http).get = "/cosmos/distribution/v1beta1/community_pool";
QueryParamsRequest
QueryParamsRequest
is the request type for the Query/Params
RPC method.
_1message QueryParamsRequest {}
QueryParamsResponse
QueryParamsResponse
is the response type for the Query/Params
RPC method.
_4message QueryParamsResponse {
_4 // params defines the parameters of the module.
_4 Params params = 1 [(gogoproto.nullable) = false];
QueryValidatorOutstandingRewardsRequest
QueryValidatorOutstandingRewardsRequest
is the request type for the Query/ValidatorOutstandingRewards
RPC method.
_4message QueryValidatorOutstandingRewardsRequest {
_4 // validator_address defines the validator address to query for.
_4 string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
QueryValidatorOutstandingRewardsResponse
QueryValidatorOutstandingRewardsResponse
is the response type for the Query/ValidatorOutstandingRewards
RPC method.
_3message QueryValidatorOutstandingRewardsResponse {
_3 ValidatorOutstandingRewards rewards = 1 [(gogoproto.nullable) = false];
QueryValidatorCommissionRequest
QueryValidatorCommissionRequest
is the request type for the Query/ValidatorCommission
RPC method.
_4message QueryValidatorCommissionRequest {
_4 // validator_address defines the validator address to query for.
_4 string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
QueryValidatorCommissionResponse
QueryValidatorCommissionResponse
is the response type for the Query/ValidatorCommission
RPC method.
_4message QueryValidatorCommissionResponse {
_4 // commission defines the commision the validator received.
_4 ValidatorAccumulatedCommission commission = 1 [(gogoproto.nullable) = false];
QueryValidatorSlashesRequest
QueryValidatorSlashesRequest
is the request type for the Query/ValidatorSlashes
RPC method.
_13message QueryValidatorSlashesRequest {
_13 option (gogoproto.goproto_getters) = false;
_13 option (gogoproto.goproto_stringer) = true;
_13 // validator_address defines the validator address to query for.
_13 string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_13 // starting_height defines the optional starting height to query the slashes.
_13 uint64 starting_height = 2;
_13 // starting_height defines the optional ending height to query the slashes.
_13 uint64 ending_height = 3;
_13 // pagination defines an optional pagination for the request.
_13 cosmos.base.query.v1beta1.PageRequest pagination = 4;
QueryValidatorSlashesResponse
QueryValidatorSlashesResponse
is the response type for the Query/ValidatorSlashes
RPC method.
_7message QueryValidatorSlashesResponse {
_7 // slashes defines the slashes the validator received.
_7 repeated ValidatorSlashEvent slashes = 1 [(gogoproto.nullable) = false];
_7 // pagination defines the pagination in the response.
_7 cosmos.base.query.v1beta1.PageResponse pagination = 2;
QueryDelegationRewardsRequest
QueryDelegationRewardsRequest
is the request type for the Query/DelegationRewards
RPC method.
_9message QueryDelegationRewardsRequest {
_9 option (gogoproto.equal) = false;
_9 option (gogoproto.goproto_getters) = false;
_9 // delegator_address defines the delegator address to query for.
_9 string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
_9 // validator_address defines the validator address to query for.
_9 string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
QueryDelegationRewardsResponse
QueryDelegationRewardsResponse
is the response type for the Query/DelegationRewards
RPC method.
_5message QueryDelegationRewardsResponse {
_5 // rewards defines the rewards accrued by a delegation.
_5 repeated cosmos.base.v1beta1.DecCoin rewards = 1
_5 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins"];
QueryDelegationTotalRewardsRequest
QueryDelegationTotalRewardsRequest
is the request type for the Query/DelegationTotalRewards
RPC method.
_6message QueryDelegationTotalRewardsRequest {
_6 option (gogoproto.equal) = false;
_6 option (gogoproto.goproto_getters) = false;
_6 // delegator_address defines the delegator address to query for.
_6 string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
QueryDelegationTotalRewardsResponse
QueryDelegationTotalRewardsResponse
is the response type for the Query/DelegationTotalRewards
RPC method.
_7message QueryDelegationTotalRewardsResponse {
_7 // rewards defines all the rewards accrued by a delegator.
_7 repeated DelegationDelegatorReward rewards = 1 [(gogoproto.nullable) = false];
_7 // total defines the sum of all the rewards.
_7 repeated cosmos.base.v1beta1.DecCoin total = 2
_7 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins"];
QueryDelegatorValidatorsRequest
QueryDelegatorValidatorsRequest
is the request type for the Query/DelegatorValidators
RPC method.
_7message QueryDelegatorValidatorsRequest {
_7 option (gogoproto.equal) = false;
_7 option (gogoproto.goproto_getters) = false;
_7 // delegator_address defines the delegator address to query for.
_7 string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
QueryDelegatorValidatorsResponse
QueryDelegatorValidatorsResponse
is the response type for the Query/DelegatorValidators
RPC method.
_7message QueryDelegatorValidatorsResponse {
_7 option (gogoproto.equal) = false;
_7 option (gogoproto.goproto_getters) = false;
_7 // validators defines the validators a delegator is delegating for.
_7 repeated string validators = 1;
QueryDelegatorWithdrawAddressRequest
QueryDelegatorWithdrawAddressRequest
is the request type for the Query/DelegatorWithdrawAddress
RPC method.
_7message QueryDelegatorWithdrawAddressRequest {
_7 option (gogoproto.equal) = false;
_7 option (gogoproto.goproto_getters) = false;
_7 // delegator_address defines the delegator address to query for.
_7 string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
QueryDelegatorWithdrawAddressResponse
QueryDelegatorWithdrawAddressResponse
is the response type for the Query/DelegatorWithdrawAddress
RPC method.
_7message QueryDelegatorWithdrawAddressResponse {
_7 option (gogoproto.equal) = false;
_7 option (gogoproto.goproto_getters) = false;
_7 // withdraw_address defines the delegator address to query for.
_7 string withdraw_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
QueryCommunityPoolRequest
is the request type for the Query/CommunityPool
RPC method.
_1message QueryCommunityPoolRequest {}
QueryCommunityPoolResponse
is the response type for the Query/CommunityPool
RPC method.
_5message QueryCommunityPoolResponse {
_5 // pool defines community pool's coins.
_5 repeated cosmos.base.v1beta1.DecCoin pool = 1
_5 [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false];