github.com/cosmos/cosmos-sdk@v0.50.10/x/staking/README.md (about) 1 --- 2 sidebar_position: 1 3 --- 4 5 # `x/staking` 6 7 ## Abstract 8 9 This paper specifies the Staking module of the Cosmos SDK that was first 10 described in the [Cosmos Whitepaper](https://cosmos.network/about/whitepaper) 11 in June 2016. 12 13 The module enables Cosmos SDK-based blockchain to support an advanced 14 Proof-of-Stake (PoS) system. In this system, holders of the native staking token of 15 the chain can become validators and can delegate tokens to validators, 16 ultimately determining the effective validator set for the system. 17 18 This module is used in the Cosmos Hub, the first Hub in the Cosmos 19 network. 20 21 ## Contents 22 23 * [State](#state) 24 * [Pool](#pool) 25 * [LastTotalPower](#lasttotalpower) 26 * [ValidatorUpdates](#validatorupdates) 27 * [UnbondingID](#unbondingid) 28 * [Params](#params) 29 * [Validator](#validator) 30 * [Delegation](#delegation) 31 * [UnbondingDelegation](#unbondingdelegation) 32 * [Redelegation](#redelegation) 33 * [Queues](#queues) 34 * [HistoricalInfo](#historicalinfo) 35 * [State Transitions](#state-transitions) 36 * [Validators](#validators) 37 * [Delegations](#delegations) 38 * [Slashing](#slashing) 39 * [How Shares are calculated](#how-shares-are-calculated) 40 * [Messages](#messages) 41 * [MsgCreateValidator](#msgcreatevalidator) 42 * [MsgEditValidator](#msgeditvalidator) 43 * [MsgDelegate](#msgdelegate) 44 * [MsgUndelegate](#msgundelegate) 45 * [MsgCancelUnbondingDelegation](#msgcancelunbondingdelegation) 46 * [MsgBeginRedelegate](#msgbeginredelegate) 47 * [MsgUpdateParams](#msgupdateparams) 48 * [Begin-Block](#begin-block) 49 * [Historical Info Tracking](#historical-info-tracking) 50 * [End-Block](#end-block) 51 * [Validator Set Changes](#validator-set-changes) 52 * [Queues](#queues-1) 53 * [Hooks](#hooks) 54 * [Events](#events) 55 * [EndBlocker](#endblocker) 56 * [Msg's](#msgs) 57 * [Parameters](#parameters) 58 * [Client](#client) 59 * [CLI](#cli) 60 * [gRPC](#grpc) 61 * [REST](#rest) 62 63 ## State 64 65 ### Pool 66 67 Pool is used for tracking bonded and not-bonded token supply of the bond denomination. 68 69 ### LastTotalPower 70 71 LastTotalPower tracks the total amounts of bonded tokens recorded during the previous end block. 72 Store entries prefixed with "Last" must remain unchanged until EndBlock. 73 74 * LastTotalPower: `0x12 -> ProtocolBuffer(math.Int)` 75 76 ### ValidatorUpdates 77 78 ValidatorUpdates contains the validator updates returned to ABCI at the end of every block. 79 The values are overwritten in every block. 80 81 * ValidatorUpdates `0x61 -> []abci.ValidatorUpdate` 82 83 ### UnbondingID 84 85 UnbondingID stores the ID of the latest unbonding operation. It enables creating unique IDs for unbonding operations, i.e., UnbondingID is incremented every time a new unbonding operation (validator unbonding, unbonding delegation, redelegation) is initiated. 86 87 * UnbondingID: `0x37 -> uint64` 88 89 ### Params 90 91 The staking module stores its params in state with the prefix of `0x51`, 92 it can be updated with governance or the address with authority. 93 94 * Params: `0x51 | ProtocolBuffer(Params)` 95 96 ```protobuf reference 97 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/staking.proto#L310-L333 98 ``` 99 100 ### Validator 101 102 Validators can have one of three statuses 103 104 * `Unbonded`: The validator is not in the active set. They cannot sign blocks and do not earn 105 rewards. They can receive delegations. 106 * `Bonded`: Once the validator receives sufficient bonded tokens they automatically join the 107 active set during [`EndBlock`](#validator-set-changes) and their status is updated to `Bonded`. 108 They are signing blocks and receiving rewards. They can receive further delegations. 109 They can be slashed for misbehavior. Delegators to this validator who unbond their delegation 110 must wait the duration of the UnbondingTime, a chain-specific param, during which time 111 they are still slashable for offences of the source validator if those offences were committed 112 during the period of time that the tokens were bonded. 113 * `Unbonding`: When a validator leaves the active set, either by choice or due to slashing, jailing or 114 tombstoning, an unbonding of all their delegations begins. All delegations must then wait the UnbondingTime 115 before their tokens are moved to their accounts from the `BondedPool`. 116 117 :::warning 118 Tombstoning is permanent, once tombstoned a validator's consensus key can not be reused within the chain where the tombstoning happened. 119 ::: 120 121 Validators objects should be primarily stored and accessed by the 122 `OperatorAddr`, an SDK validator address for the operator of the validator. Two 123 additional indices are maintained per validator object in order to fulfill 124 required lookups for slashing and validator-set updates. A third special index 125 (`LastValidatorPower`) is also maintained which however remains constant 126 throughout each block, unlike the first two indices which mirror the validator 127 records within a block. 128 129 * Validators: `0x21 | OperatorAddrLen (1 byte) | OperatorAddr -> ProtocolBuffer(validator)` 130 * ValidatorsByConsAddr: `0x22 | ConsAddrLen (1 byte) | ConsAddr -> OperatorAddr` 131 * ValidatorsByPower: `0x23 | BigEndian(ConsensusPower) | OperatorAddrLen (1 byte) | OperatorAddr -> OperatorAddr` 132 * LastValidatorsPower: `0x11 | OperatorAddrLen (1 byte) | OperatorAddr -> ProtocolBuffer(ConsensusPower)` 133 * ValidatorsByUnbondingID: `0x38 | UnbondingID -> 0x21 | OperatorAddrLen (1 byte) | OperatorAddr` 134 135 `Validators` is the primary index - it ensures that each operator can have only one 136 associated validator, where the public key of that validator can change in the 137 future. Delegators can refer to the immutable operator of the validator, without 138 concern for the changing public key. 139 140 `ValidatorsByUnbondingID` is an additional index that enables lookups for 141 validators by the unbonding IDs corresponding to their current unbonding. 142 143 `ValidatorByConsAddr` is an additional index that enables lookups for slashing. 144 When CometBFT reports evidence, it provides the validator address, so this 145 map is needed to find the operator. Note that the `ConsAddr` corresponds to the 146 address which can be derived from the validator's `ConsPubKey`. 147 148 `ValidatorsByPower` is an additional index that provides a sorted list of 149 potential validators to quickly determine the current active set. Here 150 ConsensusPower is validator.Tokens/10^6 by default. Note that all validators 151 where `Jailed` is true are not stored within this index. 152 153 `LastValidatorsPower` is a special index that provides a historical list of the 154 last-block's bonded validators. This index remains constant during a block but 155 is updated during the validator set update process which takes place in [`EndBlock`](#end-block). 156 157 Each validator's state is stored in a `Validator` struct: 158 159 ```protobuf reference 160 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/staking.proto#L82-L138 161 ``` 162 163 ```protobuf reference 164 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/staking.proto#L26-L80 165 ``` 166 167 ### Delegation 168 169 Delegations are identified by combining `DelegatorAddr` (the address of the delegator) 170 with the `ValidatorAddr` Delegators are indexed in the store as follows: 171 172 * Delegation: `0x31 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorAddr -> ProtocolBuffer(delegation)` 173 174 Stake holders may delegate coins to validators; under this circumstance their 175 funds are held in a `Delegation` data structure. It is owned by one 176 delegator, and is associated with the shares for one validator. The sender of 177 the transaction is the owner of the bond. 178 179 ```protobuf reference 180 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/staking.proto#L198-L216 181 ``` 182 183 #### Delegator Shares 184 185 When one delegates tokens to a Validator, they are issued a number of delegator shares based on a 186 dynamic exchange rate, calculated as follows from the total number of tokens delegated to the 187 validator and the number of shares issued so far: 188 189 `Shares per Token = validator.TotalShares() / validator.Tokens()` 190 191 Only the number of shares received is stored on the DelegationEntry. When a delegator then 192 Undelegates, the token amount they receive is calculated from the number of shares they currently 193 hold and the inverse exchange rate: 194 195 `Tokens per Share = validator.Tokens() / validatorShares()` 196 197 These `Shares` are simply an accounting mechanism. They are not a fungible asset. The reason for 198 this mechanism is to simplify the accounting around slashing. Rather than iteratively slashing the 199 tokens of every delegation entry, instead the Validator's total bonded tokens can be slashed, 200 effectively reducing the value of each issued delegator share. 201 202 ### UnbondingDelegation 203 204 Shares in a `Delegation` can be unbonded, but they must for some time exist as 205 an `UnbondingDelegation`, where shares can be reduced if Byzantine behavior is 206 detected. 207 208 `UnbondingDelegation` are indexed in the store as: 209 210 * UnbondingDelegation: `0x32 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorAddr -> ProtocolBuffer(unbondingDelegation)` 211 * UnbondingDelegationsFromValidator: `0x33 | ValidatorAddrLen (1 byte) | ValidatorAddr | DelegatorAddrLen (1 byte) | DelegatorAddr -> nil` 212 * UnbondingDelegationByUnbondingId: `0x38 | UnbondingId -> 0x32 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorAddr` 213 `UnbondingDelegation` is used in queries, to lookup all unbonding delegations for 214 a given delegator. 215 216 `UnbondingDelegationsFromValidator` is used in slashing, to lookup all 217 unbonding delegations associated with a given validator that need to be 218 slashed. 219 220 `UnbondingDelegationByUnbondingId` is an additional index that enables 221 lookups for unbonding delegations by the unbonding IDs of the containing 222 unbonding delegation entries. 223 224 225 A UnbondingDelegation object is created every time an unbonding is initiated. 226 227 ```protobuf reference 228 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/staking.proto#L218-L261 229 ``` 230 231 ### Redelegation 232 233 The bonded tokens worth of a `Delegation` may be instantly redelegated from a 234 source validator to a different validator (destination validator). However when 235 this occurs they must be tracked in a `Redelegation` object, whereby their 236 shares can be slashed if their tokens have contributed to a Byzantine fault 237 committed by the source validator. 238 239 `Redelegation` are indexed in the store as: 240 241 * Redelegations: `0x34 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorSrcAddr | ValidatorDstAddr -> ProtocolBuffer(redelegation)` 242 * RedelegationsBySrc: `0x35 | ValidatorSrcAddrLen (1 byte) | ValidatorSrcAddr | ValidatorDstAddrLen (1 byte) | ValidatorDstAddr | DelegatorAddrLen (1 byte) | DelegatorAddr -> nil` 243 * RedelegationsByDst: `0x36 | ValidatorDstAddrLen (1 byte) | ValidatorDstAddr | ValidatorSrcAddrLen (1 byte) | ValidatorSrcAddr | DelegatorAddrLen (1 byte) | DelegatorAddr -> nil` 244 * RedelegationByUnbondingId: `0x38 | UnbondingId -> 0x34 | DelegatorAddrLen (1 byte) | DelegatorAddr | ValidatorAddrLen (1 byte) | ValidatorSrcAddr | ValidatorDstAddr` 245 246 `Redelegations` is used for queries, to lookup all redelegations for a given 247 delegator. 248 249 `RedelegationsBySrc` is used for slashing based on the `ValidatorSrcAddr`. 250 251 `RedelegationsByDst` is used for slashing based on the `ValidatorDstAddr` 252 253 The first map here is used for queries, to lookup all redelegations for a given 254 delegator. The second map is used for slashing based on the `ValidatorSrcAddr`, 255 while the third map is for slashing based on the `ValidatorDstAddr`. 256 257 `RedelegationByUnbondingId` is an additional index that enables 258 lookups for redelegations by the unbonding IDs of the containing 259 redelegation entries. 260 261 A redelegation object is created every time a redelegation occurs. To prevent 262 "redelegation hopping" redelegations may not occur under the situation that: 263 264 * the (re)delegator already has another immature redelegation in progress 265 with a destination to a validator (let's call it `Validator X`) 266 * and, the (re)delegator is attempting to create a _new_ redelegation 267 where the source validator for this new redelegation is `Validator X`. 268 269 ```protobuf reference 270 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/staking.proto#L263-L308 271 ``` 272 273 ### Queues 274 275 All queue objects are sorted by timestamp. The time used within any queue is 276 firstly converted to UTC, rounded to the nearest nanosecond then sorted. The sortable time format 277 used is a slight modification of the RFC3339Nano and uses the format string 278 `"2006-01-02T15:04:05.000000000"`. Notably this format: 279 280 * right pads all zeros 281 * drops the time zone info (we already use UTC) 282 283 In all cases, the stored timestamp represents the maturation time of the queue 284 element. 285 286 #### UnbondingDelegationQueue 287 288 For the purpose of tracking progress of unbonding delegations the unbonding 289 delegations queue is kept. 290 291 * UnbondingDelegation: `0x41 | format(time) -> []DVPair` 292 293 ```protobuf reference 294 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/staking.proto#L162-L172 295 ``` 296 297 #### RedelegationQueue 298 299 For the purpose of tracking progress of redelegations the redelegation queue is 300 kept. 301 302 * RedelegationQueue: `0x42 | format(time) -> []DVVTriplet` 303 304 ```protobuf reference 305 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/staking.proto#L179-L191 306 ``` 307 308 #### ValidatorQueue 309 310 For the purpose of tracking progress of unbonding validators the validator 311 queue is kept. 312 313 * ValidatorQueueTime: `0x43 | format(time) -> []sdk.ValAddress` 314 315 The stored object by each key is an array of validator operator addresses from 316 which the validator object can be accessed. Typically it is expected that only 317 a single validator record will be associated with a given timestamp however it is possible 318 that multiple validators exist in the queue at the same location. 319 320 ### HistoricalInfo 321 322 HistoricalInfo objects are stored and pruned at each block such that the staking keeper persists 323 the `n` most recent historical info defined by staking module parameter: `HistoricalEntries`. 324 325 ```go reference 326 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/staking.proto#L17-L24 327 ``` 328 329 At each BeginBlock, the staking keeper will persist the current Header and the Validators that committed 330 the current block in a `HistoricalInfo` object. The Validators are sorted on their address to ensure that 331 they are in a deterministic order. 332 The oldest HistoricalEntries will be pruned to ensure that there only exist the parameter-defined number of 333 historical entries. 334 335 ## State Transitions 336 337 ### Validators 338 339 State transitions in validators are performed on every [`EndBlock`](#validator-set-changes) 340 in order to check for changes in the active `ValidatorSet`. 341 342 A validator can be `Unbonded`, `Unbonding` or `Bonded`. `Unbonded` 343 and `Unbonding` are collectively called `Not Bonded`. A validator can move 344 directly between all the states, except for from `Bonded` to `Unbonded`. 345 346 #### Not bonded to Bonded 347 348 The following transition occurs when a validator's ranking in the `ValidatorPowerIndex` surpasses 349 that of the `LastValidator`. 350 351 * set `validator.Status` to `Bonded` 352 * send the `validator.Tokens` from the `NotBondedTokens` to the `BondedPool` `ModuleAccount` 353 * delete the existing record from `ValidatorByPowerIndex` 354 * add a new updated record to the `ValidatorByPowerIndex` 355 * update the `Validator` object for this validator 356 * if it exists, delete any `ValidatorQueue` record for this validator 357 358 #### Bonded to Unbonding 359 360 When a validator begins the unbonding process the following operations occur: 361 362 * send the `validator.Tokens` from the `BondedPool` to the `NotBondedTokens` `ModuleAccount` 363 * set `validator.Status` to `Unbonding` 364 * delete the existing record from `ValidatorByPowerIndex` 365 * add a new updated record to the `ValidatorByPowerIndex` 366 * update the `Validator` object for this validator 367 * insert a new record into the `ValidatorQueue` for this validator 368 369 #### Unbonding to Unbonded 370 371 A validator moves from unbonding to unbonded when the `ValidatorQueue` object 372 moves from bonded to unbonded 373 374 * update the `Validator` object for this validator 375 * set `validator.Status` to `Unbonded` 376 377 #### Jail/Unjail 378 379 when a validator is jailed it is effectively removed from the CometBFT set. 380 this process may be also be reversed. the following operations occur: 381 382 * set `Validator.Jailed` and update object 383 * if jailed delete record from `ValidatorByPowerIndex` 384 * if unjailed add record to `ValidatorByPowerIndex` 385 386 Jailed validators are not present in any of the following stores: 387 388 * the power store (from consensus power to address) 389 390 ### Delegations 391 392 #### Delegate 393 394 When a delegation occurs both the validator and the delegation objects are affected 395 396 * determine the delegators shares based on tokens delegated and the validator's exchange rate 397 * remove tokens from the sending account 398 * add shares the delegation object or add them to a created validator object 399 * add new delegator shares and update the `Validator` object 400 * transfer the `delegation.Amount` from the delegator's account to the `BondedPool` or the `NotBondedPool` `ModuleAccount` depending if the `validator.Status` is `Bonded` or not 401 * delete the existing record from `ValidatorByPowerIndex` 402 * add an new updated record to the `ValidatorByPowerIndex` 403 404 #### Begin Unbonding 405 406 As a part of the Undelegate and Complete Unbonding state transitions Unbond 407 Delegation may be called. 408 409 * subtract the unbonded shares from delegator 410 * add the unbonded tokens to an `UnbondingDelegationEntry` 411 * update the delegation or remove the delegation if there are no more shares 412 * if the delegation is the operator of the validator and no more shares exist then trigger a jail validator 413 * update the validator with removed the delegator shares and associated coins 414 * if the validator state is `Bonded`, transfer the `Coins` worth of the unbonded 415 shares from the `BondedPool` to the `NotBondedPool` `ModuleAccount` 416 * remove the validator if it is unbonded and there are no more delegation shares. 417 * remove the validator if it is unbonded and there are no more delegation shares 418 * get a unique `unbondingId` and map it to the `UnbondingDelegationEntry` in `UnbondingDelegationByUnbondingId` 419 * call the `AfterUnbondingInitiated(unbondingId)` hook 420 * add the unbonding delegation to `UnbondingDelegationQueue` with the completion time set to `UnbondingTime` 421 422 #### Cancel an `UnbondingDelegation` Entry 423 424 When a `cancel unbond delegation` occurs both the `validator`, the `delegation` and an `UnbondingDelegationQueue` state will be updated. 425 426 * if cancel unbonding delegation amount equals to the `UnbondingDelegation` entry `balance`, then the `UnbondingDelegation` entry deleted from `UnbondingDelegationQueue`. 427 * if the `cancel unbonding delegation amount is less than the `UnbondingDelegation` entry balance, then the `UnbondingDelegation` entry will be updated with new balance in the `UnbondingDelegationQueue`. 428 * cancel `amount` is [Delegated](#delegations) back to the original `validator`. 429 430 #### Complete Unbonding 431 432 For undelegations which do not complete immediately, the following operations 433 occur when the unbonding delegation queue element matures: 434 435 * remove the entry from the `UnbondingDelegation` object 436 * transfer the tokens from the `NotBondedPool` `ModuleAccount` to the delegator `Account` 437 438 #### Begin Redelegation 439 440 Redelegations affect the delegation, source and destination validators. 441 442 * perform an `unbond` delegation from the source validator to retrieve the tokens worth of the unbonded shares 443 * using the unbonded tokens, `Delegate` them to the destination validator 444 * if the `sourceValidator.Status` is `Bonded`, and the `destinationValidator` is not, 445 transfer the newly delegated tokens from the `BondedPool` to the `NotBondedPool` `ModuleAccount` 446 * otherwise, if the `sourceValidator.Status` is not `Bonded`, and the `destinationValidator` 447 is `Bonded`, transfer the newly delegated tokens from the `NotBondedPool` to the `BondedPool` `ModuleAccount` 448 * record the token amount in an new entry in the relevant `Redelegation` 449 450 From when a redelegation begins until it completes, the delegator is in a state of "pseudo-unbonding", and can still be 451 slashed for infractions that occurred before the redelegation began. 452 453 #### Complete Redelegation 454 455 When a redelegations complete the following occurs: 456 457 * remove the entry from the `Redelegation` object 458 459 ### Slashing 460 461 #### Slash Validator 462 463 When a Validator is slashed, the following occurs: 464 465 * The total `slashAmount` is calculated as the `slashFactor` (a chain parameter) \* `TokensFromConsensusPower`, 466 the total number of tokens bonded to the validator at the time of the infraction. 467 * Every unbonding delegation and pseudo-unbonding redelegation such that the infraction occured before the unbonding or 468 redelegation began from the validator are slashed by the `slashFactor` percentage of the initialBalance. 469 * Each amount slashed from redelegations and unbonding delegations is subtracted from the 470 total slash amount. 471 * The `remaingSlashAmount` is then slashed from the validator's tokens in the `BondedPool` or 472 `NonBondedPool` depending on the validator's status. This reduces the total supply of tokens. 473 474 In the case of a slash due to any infraction that requires evidence to submitted (for example double-sign), the slash 475 occurs at the block where the evidence is included, not at the block where the infraction occured. 476 Put otherwise, validators are not slashed retroactively, only when they are caught. 477 478 #### Slash Unbonding Delegation 479 480 When a validator is slashed, so are those unbonding delegations from the validator that began unbonding 481 after the time of the infraction. Every entry in every unbonding delegation from the validator 482 is slashed by `slashFactor`. The amount slashed is calculated from the `InitialBalance` of the 483 delegation and is capped to prevent a resulting negative balance. Completed (or mature) unbondings are not slashed. 484 485 #### Slash Redelegation 486 487 When a validator is slashed, so are all redelegations from the validator that began after the 488 infraction. Redelegations are slashed by `slashFactor`. 489 Redelegations that began before the infraction are not slashed. 490 The amount slashed is calculated from the `InitialBalance` of the delegation and is capped to 491 prevent a resulting negative balance. 492 Mature redelegations (that have completed pseudo-unbonding) are not slashed. 493 494 ### How Shares are calculated 495 496 At any given point in time, each validator has a number of tokens, `T`, and has a number of shares issued, `S`. 497 Each delegator, `i`, holds a number of shares, `S_i`. 498 The number of tokens is the sum of all tokens delegated to the validator, plus the rewards, minus the slashes. 499 500 The delegator is entitled to a portion of the underlying tokens proportional to their proportion of shares. 501 So delegator `i` is entitled to `T * S_i / S` of the validator's tokens. 502 503 When a delegator delegates new tokens to the validator, they receive a number of shares proportional to their contribution. 504 So when delegator `j` delegates `T_j` tokens, they receive `S_j = S * T_j / T` shares. 505 The total number of tokens is now `T + T_j`, and the total number of shares is `S + S_j`. 506 `j`s proportion of the shares is the same as their proportion of the total tokens contributed: `(S + S_j) / S = (T + T_j) / T`. 507 508 A special case is the initial delegation, when `T = 0` and `S = 0`, so `T_j / T` is undefined. 509 For the initial delegation, delegator `j` who delegates `T_j` tokens receive `S_j = T_j` shares. 510 So a validator that hasn't received any rewards and has not been slashed will have `T = S`. 511 512 ## Messages 513 514 In this section we describe the processing of the staking messages and the corresponding updates to the state. All created/modified state objects specified by each message are defined within the [state](#state) section. 515 516 ### MsgCreateValidator 517 518 A validator is created using the `MsgCreateValidator` message. 519 The validator must be created with an initial delegation from the operator. 520 521 ```protobuf reference 522 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/tx.proto#L20-L21 523 ``` 524 525 ```protobuf reference 526 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/tx.proto#L50-L73 527 ``` 528 529 This message is expected to fail if: 530 531 * another validator with this operator address is already registered 532 * another validator with this pubkey is already registered 533 * the initial self-delegation tokens are of a denom not specified as the bonding denom 534 * the commission parameters are faulty, namely: 535 * `MaxRate` is either > 1 or < 0 536 * the initial `Rate` is either negative or > `MaxRate` 537 * the initial `MaxChangeRate` is either negative or > `MaxRate` 538 * the description fields are too large 539 540 This message creates and stores the `Validator` object at appropriate indexes. 541 Additionally a self-delegation is made with the initial tokens delegation 542 tokens `Delegation`. The validator always starts as unbonded but may be bonded 543 in the first end-block. 544 545 ### MsgEditValidator 546 547 The `Description`, `CommissionRate` of a validator can be updated using the 548 `MsgEditValidator` message. 549 550 ```protobuf reference 551 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/tx.proto#L23-L24 552 ``` 553 554 ```protobuf reference 555 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/tx.proto#L78-L97 556 ``` 557 558 This message is expected to fail if: 559 560 * the initial `CommissionRate` is either negative or > `MaxRate` 561 * the `CommissionRate` has already been updated within the previous 24 hours 562 * the `CommissionRate` is > `MaxChangeRate` 563 * the description fields are too large 564 565 This message stores the updated `Validator` object. 566 567 ### MsgDelegate 568 569 Within this message the delegator provides coins, and in return receives 570 some amount of their validator's (newly created) delegator-shares that are 571 assigned to `Delegation.Shares`. 572 573 ```protobuf reference 574 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/tx.proto#L26-L28 575 ``` 576 577 ```protobuf reference 578 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/tx.proto#L102-L114 579 ``` 580 581 This message is expected to fail if: 582 583 * the validator does not exist 584 * the `Amount` `Coin` has a denomination different than one defined by `params.BondDenom` 585 * the exchange rate is invalid, meaning the validator has no tokens (due to slashing) but there are outstanding shares 586 * the amount delegated is less than the minimum allowed delegation 587 588 If an existing `Delegation` object for provided addresses does not already 589 exist then it is created as part of this message otherwise the existing 590 `Delegation` is updated to include the newly received shares. 591 592 The delegator receives newly minted shares at the current exchange rate. 593 The exchange rate is the number of existing shares in the validator divided by 594 the number of currently delegated tokens. 595 596 The validator is updated in the `ValidatorByPower` index, and the delegation is 597 tracked in validator object in the `Validators` index. 598 599 It is possible to delegate to a jailed validator, the only difference being it 600 will not be added to the power index until it is unjailed. 601 602  603 604 ### MsgUndelegate 605 606 The `MsgUndelegate` message allows delegators to undelegate their tokens from 607 validator. 608 609 ```protobuf reference 610 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/tx.proto#L34-L36 611 ``` 612 613 ```protobuf reference 614 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/tx.proto#L140-L152 615 ``` 616 617 This message returns a response containing the completion time of the undelegation: 618 619 ```protobuf reference 620 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/tx.proto#L154-L158 621 ``` 622 623 This message is expected to fail if: 624 625 * the delegation doesn't exist 626 * the validator doesn't exist 627 * the delegation has less shares than the ones worth of `Amount` 628 * existing `UnbondingDelegation` has maximum entries as defined by `params.MaxEntries` 629 * the `Amount` has a denomination different than one defined by `params.BondDenom` 630 631 When this message is processed the following actions occur: 632 633 * validator's `DelegatorShares` and the delegation's `Shares` are both reduced by the message `SharesAmount` 634 * calculate the token worth of the shares remove that amount tokens held within the validator 635 * with those removed tokens, if the validator is: 636 * `Bonded` - add them to an entry in `UnbondingDelegation` (create `UnbondingDelegation` if it doesn't exist) with a completion time a full unbonding period from the current time. Update pool shares to reduce BondedTokens and increase NotBondedTokens by token worth of the shares. 637 * `Unbonding` - add them to an entry in `UnbondingDelegation` (create `UnbondingDelegation` if it doesn't exist) with the same completion time as the validator (`UnbondingMinTime`). 638 * `Unbonded` - then send the coins the message `DelegatorAddr` 639 * if there are no more `Shares` in the delegation, then the delegation object is removed from the store 640 * under this situation if the delegation is the validator's self-delegation then also jail the validator. 641 642  643 644 ### MsgCancelUnbondingDelegation 645 646 The `MsgCancelUnbondingDelegation` message allows delegators to cancel the `unbondingDelegation` entry and delegate back to a previous validator. 647 648 ```protobuf reference 649 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/tx.proto#L38-L42 650 ``` 651 652 ```protobuf reference 653 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/tx.proto#L160-L175 654 ``` 655 656 This message is expected to fail if: 657 658 * the `unbondingDelegation` entry is already processed. 659 * the `cancel unbonding delegation` amount is greater than the `unbondingDelegation` entry balance. 660 * the `cancel unbonding delegation` height doesn't exist in the `unbondingDelegationQueue` of the delegator. 661 662 When this message is processed the following actions occur: 663 664 * if the `unbondingDelegation` Entry balance is zero 665 * in this condition `unbondingDelegation` entry will be removed from `unbondingDelegationQueue`. 666 * otherwise `unbondingDelegationQueue` will be updated with new `unbondingDelegation` entry balance and initial balance 667 * the validator's `DelegatorShares` and the delegation's `Shares` are both increased by the message `Amount`. 668 669 ### MsgBeginRedelegate 670 671 The redelegation command allows delegators to instantly switch validators. Once 672 the unbonding period has passed, the redelegation is automatically completed in 673 the EndBlocker. 674 675 ```protobuf reference 676 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/tx.proto#L30-L32 677 ``` 678 679 ```protobuf reference 680 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/tx.proto#L119-L132 681 ``` 682 683 This message returns a response containing the completion time of the redelegation: 684 685 ```protobuf reference 686 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/tx.proto#L133-L138 687 ``` 688 689 This message is expected to fail if: 690 691 * the delegation doesn't exist 692 * the source or destination validators don't exist 693 * the delegation has less shares than the ones worth of `Amount` 694 * the source validator has a receiving redelegation which is not matured (aka. the redelegation may be transitive) 695 * existing `Redelegation` has maximum entries as defined by `params.MaxEntries` 696 * the `Amount` `Coin` has a denomination different than one defined by `params.BondDenom` 697 698 When this message is processed the following actions occur: 699 700 * the source validator's `DelegatorShares` and the delegations `Shares` are both reduced by the message `SharesAmount` 701 * calculate the token worth of the shares remove that amount tokens held within the source validator. 702 * if the source validator is: 703 * `Bonded` - add an entry to the `Redelegation` (create `Redelegation` if it doesn't exist) with a completion time a full unbonding period from the current time. Update pool shares to reduce BondedTokens and increase NotBondedTokens by token worth of the shares (this may be effectively reversed in the next step however). 704 * `Unbonding` - add an entry to the `Redelegation` (create `Redelegation` if it doesn't exist) with the same completion time as the validator (`UnbondingMinTime`). 705 * `Unbonded` - no action required in this step 706 * Delegate the token worth to the destination validator, possibly moving tokens back to the bonded state. 707 * if there are no more `Shares` in the source delegation, then the source delegation object is removed from the store 708 * under this situation if the delegation is the validator's self-delegation then also jail the validator. 709 710  711 712 713 ### MsgUpdateParams 714 715 The `MsgUpdateParams` update the staking module parameters. 716 The params are updated through a governance proposal where the signer is the gov module account address. 717 718 ```protobuf reference 719 https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/tx.proto#L182-L195 720 ``` 721 722 The message handling can fail if: 723 724 * signer is not the authority defined in the staking keeper (usually the gov module account). 725 726 ## Begin-Block 727 728 Each abci begin block call, the historical info will get stored and pruned 729 according to the `HistoricalEntries` parameter. 730 731 ### Historical Info Tracking 732 733 If the `HistoricalEntries` parameter is 0, then the `BeginBlock` performs a no-op. 734 735 Otherwise, the latest historical info is stored under the key `historicalInfoKey|height`, while any entries older than `height - HistoricalEntries` is deleted. 736 In most cases, this results in a single entry being pruned per block. 737 However, if the parameter `HistoricalEntries` has changed to a lower value there will be multiple entries in the store that must be pruned. 738 739 ## End-Block 740 741 Each abci end block call, the operations to update queues and validator set 742 changes are specified to execute. 743 744 ### Validator Set Changes 745 746 The staking validator set is updated during this process by state transitions 747 that run at the end of every block. As a part of this process any updated 748 validators are also returned back to CometBFT for inclusion in the CometBFT 749 validator set which is responsible for validating CometBFT messages at the 750 consensus layer. Operations are as following: 751 752 * the new validator set is taken as the top `params.MaxValidators` number of 753 validators retrieved from the `ValidatorsByPower` index 754 * the previous validator set is compared with the new validator set: 755 * missing validators begin unbonding and their `Tokens` are transferred from the 756 `BondedPool` to the `NotBondedPool` `ModuleAccount` 757 * new validators are instantly bonded and their `Tokens` are transferred from the 758 `NotBondedPool` to the `BondedPool` `ModuleAccount` 759 760 In all cases, any validators leaving or entering the bonded validator set or 761 changing balances and staying within the bonded validator set incur an update 762 message reporting their new consensus power which is passed back to CometBFT. 763 764 The `LastTotalPower` and `LastValidatorsPower` hold the state of the total power 765 and validator power from the end of the last block, and are used to check for 766 changes that have occurred in `ValidatorsByPower` and the total new power, which 767 is calculated during `EndBlock`. 768 769 ### Queues 770 771 Within staking, certain state-transitions are not instantaneous but take place 772 over a duration of time (typically the unbonding period). When these 773 transitions are mature certain operations must take place in order to complete 774 the state operation. This is achieved through the use of queues which are 775 checked/processed at the end of each block. 776 777 #### Unbonding Validators 778 779 When a validator is kicked out of the bonded validator set (either through 780 being jailed, or not having sufficient bonded tokens) it begins the unbonding 781 process along with all its delegations begin unbonding (while still being 782 delegated to this validator). At this point the validator is said to be an 783 "unbonding validator", whereby it will mature to become an "unbonded validator" 784 after the unbonding period has passed. 785 786 Each block the validator queue is to be checked for mature unbonding validators 787 (namely with a completion time <= current time and completion height <= current 788 block height). At this point any mature validators which do not have any 789 delegations remaining are deleted from state. For all other mature unbonding 790 validators that still have remaining delegations, the `validator.Status` is 791 switched from `types.Unbonding` to 792 `types.Unbonded`. 793 794 Unbonding operations can be put on hold by external modules via the `PutUnbondingOnHold(unbondingId)` method. 795 As a result, an unbonding operation (e.g., an unbonding delegation) that is on hold, cannot complete 796 even if it reaches maturity. For an unbonding operation with `unbondingId` to eventually complete 797 (after it reaches maturity), every call to `PutUnbondingOnHold(unbondingId)` must be matched 798 by a call to `UnbondingCanComplete(unbondingId)`. 799 800 #### Unbonding Delegations 801 802 Complete the unbonding of all mature `UnbondingDelegations.Entries` within the 803 `UnbondingDelegations` queue with the following procedure: 804 805 * transfer the balance coins to the delegator's wallet address 806 * remove the mature entry from `UnbondingDelegation.Entries` 807 * remove the `UnbondingDelegation` object from the store if there are no 808 remaining entries. 809 810 #### Redelegations 811 812 Complete the unbonding of all mature `Redelegation.Entries` within the 813 `Redelegations` queue with the following procedure: 814 815 * remove the mature entry from `Redelegation.Entries` 816 * remove the `Redelegation` object from the store if there are no 817 remaining entries. 818 819 ## Hooks 820 821 Other modules may register operations to execute when a certain event has 822 occurred within staking. These events can be registered to execute either 823 right `Before` or `After` the staking event (as per the hook name). The 824 following hooks can registered with staking: 825 826 * `AfterValidatorCreated(Context, ValAddress) error` 827 * called when a validator is created 828 * `BeforeValidatorModified(Context, ValAddress) error` 829 * called when a validator's state is changed 830 * `AfterValidatorRemoved(Context, ConsAddress, ValAddress) error` 831 * called when a validator is deleted 832 * `AfterValidatorBonded(Context, ConsAddress, ValAddress) error` 833 * called when a validator is bonded 834 * `AfterValidatorBeginUnbonding(Context, ConsAddress, ValAddress) error` 835 * called when a validator begins unbonding 836 * `BeforeDelegationCreated(Context, AccAddress, ValAddress) error` 837 * called when a delegation is created 838 * `BeforeDelegationSharesModified(Context, AccAddress, ValAddress) error` 839 * called when a delegation's shares are modified 840 * `AfterDelegationModified(Context, AccAddress, ValAddress) error` 841 * called when a delegation is created or modified 842 * `BeforeDelegationRemoved(Context, AccAddress, ValAddress) error` 843 * called when a delegation is removed 844 * `AfterUnbondingInitiated(Context, UnbondingID)` 845 * called when an unbonding operation (validator unbonding, unbonding delegation, redelegation) was initiated 846 847 848 ## Events 849 850 The staking module emits the following events: 851 852 ### EndBlocker 853 854 | Type | Attribute Key | Attribute Value | 855 | --------------------- | --------------------- | ------------------------- | 856 | complete_unbonding | amount | {totalUnbondingAmount} | 857 | complete_unbonding | validator | {validatorAddress} | 858 | complete_unbonding | delegator | {delegatorAddress} | 859 | complete_redelegation | amount | {totalRedelegationAmount} | 860 | complete_redelegation | source_validator | {srcValidatorAddress} | 861 | complete_redelegation | destination_validator | {dstValidatorAddress} | 862 | complete_redelegation | delegator | {delegatorAddress} | 863 864 ## Msg's 865 866 ### MsgCreateValidator 867 868 | Type | Attribute Key | Attribute Value | 869 | ---------------- | ------------- | ------------------ | 870 | create_validator | validator | {validatorAddress} | 871 | create_validator | amount | {delegationAmount} | 872 | message | module | staking | 873 | message | action | create_validator | 874 | message | sender | {senderAddress} | 875 876 ### MsgEditValidator 877 878 | Type | Attribute Key | Attribute Value | 879 | -------------- | ------------------- | ------------------- | 880 | edit_validator | commission_rate | {commissionRate} | 881 | edit_validator | min_self_delegation | {minSelfDelegation} | 882 | message | module | staking | 883 | message | action | edit_validator | 884 | message | sender | {senderAddress} | 885 886 ### MsgDelegate 887 888 | Type | Attribute Key | Attribute Value | 889 | -------- | ------------- | ------------------ | 890 | delegate | validator | {validatorAddress} | 891 | delegate | amount | {delegationAmount} | 892 | message | module | staking | 893 | message | action | delegate | 894 | message | sender | {senderAddress} | 895 896 ### MsgUndelegate 897 898 | Type | Attribute Key | Attribute Value | 899 | ------- | ------------------- | ------------------ | 900 | unbond | validator | {validatorAddress} | 901 | unbond | amount | {unbondAmount} | 902 | unbond | completion_time [0] | {completionTime} | 903 | message | module | staking | 904 | message | action | begin_unbonding | 905 | message | sender | {senderAddress} | 906 907 * [0] Time is formatted in the RFC3339 standard 908 909 ### MsgCancelUnbondingDelegation 910 911 | Type | Attribute Key | Attribute Value | 912 | ----------------------------- | ------------------ | ------------------------------------| 913 | cancel_unbonding_delegation | validator | {validatorAddress} | 914 | cancel_unbonding_delegation | delegator | {delegatorAddress} | 915 | cancel_unbonding_delegation | amount | {cancelUnbondingDelegationAmount} | 916 | cancel_unbonding_delegation | creation_height | {unbondingCreationHeight} | 917 | message | module | staking | 918 | message | action | cancel_unbond | 919 | message | sender | {senderAddress} | 920 921 ### MsgBeginRedelegate 922 923 | Type | Attribute Key | Attribute Value | 924 | ---------- | --------------------- | --------------------- | 925 | redelegate | source_validator | {srcValidatorAddress} | 926 | redelegate | destination_validator | {dstValidatorAddress} | 927 | redelegate | amount | {unbondAmount} | 928 | redelegate | completion_time [0] | {completionTime} | 929 | message | module | staking | 930 | message | action | begin_redelegate | 931 | message | sender | {senderAddress} | 932 933 * [0] Time is formatted in the RFC3339 standard 934 935 ## Parameters 936 937 The staking module contains the following parameters: 938 939 | Key | Type | Example | 940 |-------------------|------------------|------------------------| 941 | UnbondingTime | string (time ns) | "259200000000000" | 942 | MaxValidators | uint16 | 100 | 943 | KeyMaxEntries | uint16 | 7 | 944 | HistoricalEntries | uint16 | 3 | 945 | BondDenom | string | "stake" | 946 | MinCommissionRate | string | "0.000000000000000000" | 947 948 ## Client 949 950 ### CLI 951 952 A user can query and interact with the `staking` module using the CLI. 953 954 #### Query 955 956 The `query` commands allows users to query `staking` state. 957 958 ```bash 959 simd query staking --help 960 ``` 961 962 ##### delegation 963 964 The `delegation` command allows users to query delegations for an individual delegator on an individual validator. 965 966 Usage: 967 968 ```bash 969 simd query staking delegation [delegator-addr] [validator-addr] [flags] 970 ``` 971 972 Example: 973 974 ```bash 975 simd query staking delegation cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 976 ``` 977 978 Example Output: 979 980 ```bash 981 balance: 982 amount: "10000000000" 983 denom: stake 984 delegation: 985 delegator_address: cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p 986 shares: "10000000000.000000000000000000" 987 validator_address: cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 988 ``` 989 990 ##### delegations 991 992 The `delegations` command allows users to query delegations for an individual delegator on all validators. 993 994 Usage: 995 996 ```bash 997 simd query staking delegations [delegator-addr] [flags] 998 ``` 999 1000 Example: 1001 1002 ```bash 1003 simd query staking delegations cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p 1004 ``` 1005 1006 Example Output: 1007 1008 ```bash 1009 delegation_responses: 1010 - balance: 1011 amount: "10000000000" 1012 denom: stake 1013 delegation: 1014 delegator_address: cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p 1015 shares: "10000000000.000000000000000000" 1016 validator_address: cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 1017 - balance: 1018 amount: "10000000000" 1019 denom: stake 1020 delegation: 1021 delegator_address: cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p 1022 shares: "10000000000.000000000000000000" 1023 validator_address: cosmosvaloper1x20lytyf6zkcrv5edpkfkn8sz578qg5sqfyqnp 1024 pagination: 1025 next_key: null 1026 total: "0" 1027 ``` 1028 1029 ##### delegations-to 1030 1031 The `delegations-to` command allows users to query delegations on an individual validator. 1032 1033 Usage: 1034 1035 ```bash 1036 simd query staking delegations-to [validator-addr] [flags] 1037 ``` 1038 1039 Example: 1040 1041 ```bash 1042 simd query staking delegations-to cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 1043 ``` 1044 1045 Example Output: 1046 1047 ```bash 1048 - balance: 1049 amount: "504000000" 1050 denom: stake 1051 delegation: 1052 delegator_address: cosmos1q2qwwynhv8kh3lu5fkeex4awau9x8fwt45f5cp 1053 shares: "504000000.000000000000000000" 1054 validator_address: cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 1055 - balance: 1056 amount: "78125000000" 1057 denom: uixo 1058 delegation: 1059 delegator_address: cosmos1qvppl3479hw4clahe0kwdlfvf8uvjtcd99m2ca 1060 shares: "78125000000.000000000000000000" 1061 validator_address: cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 1062 pagination: 1063 next_key: null 1064 total: "0" 1065 ``` 1066 1067 ##### historical-info 1068 1069 The `historical-info` command allows users to query historical information at given height. 1070 1071 Usage: 1072 1073 ```bash 1074 simd query staking historical-info [height] [flags] 1075 ``` 1076 1077 Example: 1078 1079 ```bash 1080 simd query staking historical-info 10 1081 ``` 1082 1083 Example Output: 1084 1085 ```bash 1086 header: 1087 app_hash: Lbx8cXpI868wz8sgp4qPYVrlaKjevR5WP/IjUxwp3oo= 1088 chain_id: testnet 1089 consensus_hash: BICRvH3cKD93v7+R1zxE2ljD34qcvIZ0Bdi389qtoi8= 1090 data_hash: 47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= 1091 evidence_hash: 47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= 1092 height: "10" 1093 last_block_id: 1094 hash: RFbkpu6pWfSThXxKKl6EZVDnBSm16+U0l0xVjTX08Fk= 1095 part_set_header: 1096 hash: vpIvXD4rxD5GM4MXGz0Sad9I7//iVYLzZsEU4BVgWIU= 1097 total: 1 1098 last_commit_hash: Ne4uXyx4QtNp4Zx89kf9UK7oG9QVbdB6e7ZwZkhy8K0= 1099 last_results_hash: 47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= 1100 next_validators_hash: nGBgKeWBjoxeKFti00CxHsnULORgKY4LiuQwBuUrhCs= 1101 proposer_address: mMEP2c2IRPLr99LedSRtBg9eONM= 1102 time: "2021-10-01T06:00:49.785790894Z" 1103 validators_hash: nGBgKeWBjoxeKFti00CxHsnULORgKY4LiuQwBuUrhCs= 1104 version: 1105 app: "0" 1106 block: "11" 1107 valset: 1108 - commission: 1109 commission_rates: 1110 max_change_rate: "0.010000000000000000" 1111 max_rate: "0.200000000000000000" 1112 rate: "0.100000000000000000" 1113 update_time: "2021-10-01T05:52:50.380144238Z" 1114 consensus_pubkey: 1115 '@type': /cosmos.crypto.ed25519.PubKey 1116 key: Auxs3865HpB/EfssYOzfqNhEJjzys2Fo6jD5B8tPgC8= 1117 delegator_shares: "10000000.000000000000000000" 1118 description: 1119 details: "" 1120 identity: "" 1121 moniker: myvalidator 1122 security_contact: "" 1123 website: "" 1124 jailed: false 1125 min_self_delegation: "1" 1126 operator_address: cosmosvaloper1rne8lgs98p0jqe82sgt0qr4rdn4hgvmgp9ggcc 1127 status: BOND_STATUS_BONDED 1128 tokens: "10000000" 1129 unbonding_height: "0" 1130 unbonding_time: "1970-01-01T00:00:00Z" 1131 ``` 1132 1133 ##### params 1134 1135 The `params` command allows users to query values set as staking parameters. 1136 1137 Usage: 1138 1139 ```bash 1140 simd query staking params [flags] 1141 ``` 1142 1143 Example: 1144 1145 ```bash 1146 simd query staking params 1147 ``` 1148 1149 Example Output: 1150 1151 ```bash 1152 bond_denom: stake 1153 historical_entries: 10000 1154 max_entries: 7 1155 max_validators: 50 1156 unbonding_time: 1814400s 1157 ``` 1158 1159 ##### pool 1160 1161 The `pool` command allows users to query values for amounts stored in the staking pool. 1162 1163 Usage: 1164 1165 ```bash 1166 simd q staking pool [flags] 1167 ``` 1168 1169 Example: 1170 1171 ```bash 1172 simd q staking pool 1173 ``` 1174 1175 Example Output: 1176 1177 ```bash 1178 bonded_tokens: "10000000" 1179 not_bonded_tokens: "0" 1180 ``` 1181 1182 ##### redelegation 1183 1184 The `redelegation` command allows users to query a redelegation record based on delegator and a source and destination validator address. 1185 1186 Usage: 1187 1188 ```bash 1189 simd query staking redelegation [delegator-addr] [src-validator-addr] [dst-validator-addr] [flags] 1190 ``` 1191 1192 Example: 1193 1194 ```bash 1195 simd query staking redelegation cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p cosmosvaloper1l2rsakp388kuv9k8qzq6lrm9taddae7fpx59wm cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 1196 ``` 1197 1198 Example Output: 1199 1200 ```bash 1201 pagination: null 1202 redelegation_responses: 1203 - entries: 1204 - balance: "50000000" 1205 redelegation_entry: 1206 completion_time: "2021-10-24T20:33:21.960084845Z" 1207 creation_height: 2.382847e+06 1208 initial_balance: "50000000" 1209 shares_dst: "50000000.000000000000000000" 1210 - balance: "5000000000" 1211 redelegation_entry: 1212 completion_time: "2021-10-25T21:33:54.446846862Z" 1213 creation_height: 2.397271e+06 1214 initial_balance: "5000000000" 1215 shares_dst: "5000000000.000000000000000000" 1216 redelegation: 1217 delegator_address: cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p 1218 entries: null 1219 validator_dst_address: cosmosvaloper1l2rsakp388kuv9k8qzq6lrm9taddae7fpx59wm 1220 validator_src_address: cosmosvaloper1l2rsakp388kuv9k8qzq6lrm9taddae7fpx59wm 1221 ``` 1222 1223 ##### redelegations 1224 1225 The `redelegations` command allows users to query all redelegation records for an individual delegator. 1226 1227 Usage: 1228 1229 ```bash 1230 simd query staking redelegations [delegator-addr] [flags] 1231 ``` 1232 1233 Example: 1234 1235 ```bash 1236 simd query staking redelegation cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p 1237 ``` 1238 1239 Example Output: 1240 1241 ```bash 1242 pagination: 1243 next_key: null 1244 total: "0" 1245 redelegation_responses: 1246 - entries: 1247 - balance: "50000000" 1248 redelegation_entry: 1249 completion_time: "2021-10-24T20:33:21.960084845Z" 1250 creation_height: 2.382847e+06 1251 initial_balance: "50000000" 1252 shares_dst: "50000000.000000000000000000" 1253 - balance: "5000000000" 1254 redelegation_entry: 1255 completion_time: "2021-10-25T21:33:54.446846862Z" 1256 creation_height: 2.397271e+06 1257 initial_balance: "5000000000" 1258 shares_dst: "5000000000.000000000000000000" 1259 redelegation: 1260 delegator_address: cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p 1261 entries: null 1262 validator_dst_address: cosmosvaloper1uccl5ugxrm7vqlzwqr04pjd320d2fz0z3hc6vm 1263 validator_src_address: cosmosvaloper1zppjyal5emta5cquje8ndkpz0rs046m7zqxrpp 1264 - entries: 1265 - balance: "562770000000" 1266 redelegation_entry: 1267 completion_time: "2021-10-25T21:42:07.336911677Z" 1268 creation_height: 2.39735e+06 1269 initial_balance: "562770000000" 1270 shares_dst: "562770000000.000000000000000000" 1271 redelegation: 1272 delegator_address: cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p 1273 entries: null 1274 validator_dst_address: cosmosvaloper1uccl5ugxrm7vqlzwqr04pjd320d2fz0z3hc6vm 1275 validator_src_address: cosmosvaloper1zppjyal5emta5cquje8ndkpz0rs046m7zqxrpp 1276 ``` 1277 1278 ##### redelegations-from 1279 1280 The `redelegations-from` command allows users to query delegations that are redelegating _from_ a validator. 1281 1282 Usage: 1283 1284 ```bash 1285 simd query staking redelegations-from [validator-addr] [flags] 1286 ``` 1287 1288 Example: 1289 1290 ```bash 1291 simd query staking redelegations-from cosmosvaloper1y4rzzrgl66eyhzt6gse2k7ej3zgwmngeleucjy 1292 ``` 1293 1294 Example Output: 1295 1296 ```bash 1297 pagination: 1298 next_key: null 1299 total: "0" 1300 redelegation_responses: 1301 - entries: 1302 - balance: "50000000" 1303 redelegation_entry: 1304 completion_time: "2021-10-24T20:33:21.960084845Z" 1305 creation_height: 2.382847e+06 1306 initial_balance: "50000000" 1307 shares_dst: "50000000.000000000000000000" 1308 - balance: "5000000000" 1309 redelegation_entry: 1310 completion_time: "2021-10-25T21:33:54.446846862Z" 1311 creation_height: 2.397271e+06 1312 initial_balance: "5000000000" 1313 shares_dst: "5000000000.000000000000000000" 1314 redelegation: 1315 delegator_address: cosmos1pm6e78p4pgn0da365plzl4t56pxy8hwtqp2mph 1316 entries: null 1317 validator_dst_address: cosmosvaloper1uccl5ugxrm7vqlzwqr04pjd320d2fz0z3hc6vm 1318 validator_src_address: cosmosvaloper1y4rzzrgl66eyhzt6gse2k7ej3zgwmngeleucjy 1319 - entries: 1320 - balance: "221000000" 1321 redelegation_entry: 1322 completion_time: "2021-10-05T21:05:45.669420544Z" 1323 creation_height: 2.120693e+06 1324 initial_balance: "221000000" 1325 shares_dst: "221000000.000000000000000000" 1326 redelegation: 1327 delegator_address: cosmos1zqv8qxy2zgn4c58fz8jt8jmhs3d0attcussrf6 1328 entries: null 1329 validator_dst_address: cosmosvaloper10mseqwnwtjaqfrwwp2nyrruwmjp6u5jhah4c3y 1330 validator_src_address: cosmosvaloper1y4rzzrgl66eyhzt6gse2k7ej3zgwmngeleucjy 1331 ``` 1332 1333 ##### unbonding-delegation 1334 1335 The `unbonding-delegation` command allows users to query unbonding delegations for an individual delegator on an individual validator. 1336 1337 Usage: 1338 1339 ```bash 1340 simd query staking unbonding-delegation [delegator-addr] [validator-addr] [flags] 1341 ``` 1342 1343 Example: 1344 1345 ```bash 1346 simd query staking unbonding-delegation cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 1347 ``` 1348 1349 Example Output: 1350 1351 ```bash 1352 delegator_address: cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p 1353 entries: 1354 - balance: "52000000" 1355 completion_time: "2021-11-02T11:35:55.391594709Z" 1356 creation_height: "55078" 1357 initial_balance: "52000000" 1358 validator_address: cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 1359 ``` 1360 1361 ##### unbonding-delegations 1362 1363 The `unbonding-delegations` command allows users to query all unbonding-delegations records for one delegator. 1364 1365 Usage: 1366 1367 ```bash 1368 simd query staking unbonding-delegations [delegator-addr] [flags] 1369 ``` 1370 1371 Example: 1372 1373 ```bash 1374 simd query staking unbonding-delegations cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p 1375 ``` 1376 1377 Example Output: 1378 1379 ```bash 1380 pagination: 1381 next_key: null 1382 total: "0" 1383 unbonding_responses: 1384 - delegator_address: cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p 1385 entries: 1386 - balance: "52000000" 1387 completion_time: "2021-11-02T11:35:55.391594709Z" 1388 creation_height: "55078" 1389 initial_balance: "52000000" 1390 validator_address: cosmosvaloper1t8ehvswxjfn3ejzkjtntcyrqwvmvuknzmvtaaa 1391 1392 ``` 1393 1394 ##### unbonding-delegations-from 1395 1396 The `unbonding-delegations-from` command allows users to query delegations that are unbonding _from_ a validator. 1397 1398 Usage: 1399 1400 ```bash 1401 simd query staking unbonding-delegations-from [validator-addr] [flags] 1402 ``` 1403 1404 Example: 1405 1406 ```bash 1407 simd query staking unbonding-delegations-from cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 1408 ``` 1409 1410 Example Output: 1411 1412 ```bash 1413 pagination: 1414 next_key: null 1415 total: "0" 1416 unbonding_responses: 1417 - delegator_address: cosmos1qqq9txnw4c77sdvzx0tkedsafl5s3vk7hn53fn 1418 entries: 1419 - balance: "150000000" 1420 completion_time: "2021-11-01T21:41:13.098141574Z" 1421 creation_height: "46823" 1422 initial_balance: "150000000" 1423 validator_address: cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 1424 - delegator_address: cosmos1peteje73eklqau66mr7h7rmewmt2vt99y24f5z 1425 entries: 1426 - balance: "24000000" 1427 completion_time: "2021-10-31T02:57:18.192280361Z" 1428 creation_height: "21516" 1429 initial_balance: "24000000" 1430 validator_address: cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 1431 ``` 1432 1433 ##### validator 1434 1435 The `validator` command allows users to query details about an individual validator. 1436 1437 Usage: 1438 1439 ```bash 1440 simd query staking validator [validator-addr] [flags] 1441 ``` 1442 1443 Example: 1444 1445 ```bash 1446 simd query staking validator cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 1447 ``` 1448 1449 Example Output: 1450 1451 ```bash 1452 commission: 1453 commission_rates: 1454 max_change_rate: "0.020000000000000000" 1455 max_rate: "0.200000000000000000" 1456 rate: "0.050000000000000000" 1457 update_time: "2021-10-01T19:24:52.663191049Z" 1458 consensus_pubkey: 1459 '@type': /cosmos.crypto.ed25519.PubKey 1460 key: sIiexdJdYWn27+7iUHQJDnkp63gq/rzUq1Y+fxoGjXc= 1461 delegator_shares: "32948270000.000000000000000000" 1462 description: 1463 details: Witval is the validator arm from Vitwit. Vitwit is into software consulting 1464 and services business since 2015. We are working closely with Cosmos ecosystem 1465 since 2018. We are also building tools for the ecosystem, Aneka is our explorer 1466 for the cosmos ecosystem. 1467 identity: 51468B615127273A 1468 moniker: Witval 1469 security_contact: "" 1470 website: "" 1471 jailed: false 1472 min_self_delegation: "1" 1473 operator_address: cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 1474 status: BOND_STATUS_BONDED 1475 tokens: "32948270000" 1476 unbonding_height: "0" 1477 unbonding_time: "1970-01-01T00:00:00Z" 1478 ``` 1479 1480 ##### validators 1481 1482 The `validators` command allows users to query details about all validators on a network. 1483 1484 Usage: 1485 1486 ```bash 1487 simd query staking validators [flags] 1488 ``` 1489 1490 Example: 1491 1492 ```bash 1493 simd query staking validators 1494 ``` 1495 1496 Example Output: 1497 1498 ```bash 1499 pagination: 1500 next_key: FPTi7TKAjN63QqZh+BaXn6gBmD5/ 1501 total: "0" 1502 validators: 1503 commission: 1504 commission_rates: 1505 max_change_rate: "0.020000000000000000" 1506 max_rate: "0.200000000000000000" 1507 rate: "0.050000000000000000" 1508 update_time: "2021-10-01T19:24:52.663191049Z" 1509 consensus_pubkey: 1510 '@type': /cosmos.crypto.ed25519.PubKey 1511 key: sIiexdJdYWn27+7iUHQJDnkp63gq/rzUq1Y+fxoGjXc= 1512 delegator_shares: "32948270000.000000000000000000" 1513 description: 1514 details: Witval is the validator arm from Vitwit. Vitwit is into software consulting 1515 and services business since 2015. We are working closely with Cosmos ecosystem 1516 since 2018. We are also building tools for the ecosystem, Aneka is our explorer 1517 for the cosmos ecosystem. 1518 identity: 51468B615127273A 1519 moniker: Witval 1520 security_contact: "" 1521 website: "" 1522 jailed: false 1523 min_self_delegation: "1" 1524 operator_address: cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 1525 status: BOND_STATUS_BONDED 1526 tokens: "32948270000" 1527 unbonding_height: "0" 1528 unbonding_time: "1970-01-01T00:00:00Z" 1529 - commission: 1530 commission_rates: 1531 max_change_rate: "0.100000000000000000" 1532 max_rate: "0.200000000000000000" 1533 rate: "0.050000000000000000" 1534 update_time: "2021-10-04T18:02:21.446645619Z" 1535 consensus_pubkey: 1536 '@type': /cosmos.crypto.ed25519.PubKey 1537 key: GDNpuKDmCg9GnhnsiU4fCWktuGUemjNfvpCZiqoRIYA= 1538 delegator_shares: "559343421.000000000000000000" 1539 description: 1540 details: Noderunners is a professional validator in POS networks. We have a huge 1541 node running experience, reliable soft and hardware. Our commissions are always 1542 low, our support to delegators is always full. Stake with us and start receiving 1543 your Cosmos rewards now! 1544 identity: 812E82D12FEA3493 1545 moniker: Noderunners 1546 security_contact: info@noderunners.biz 1547 website: http://noderunners.biz 1548 jailed: false 1549 min_self_delegation: "1" 1550 operator_address: cosmosvaloper1q5ku90atkhktze83j9xjaks2p7uruag5zp6wt7 1551 status: BOND_STATUS_BONDED 1552 tokens: "559343421" 1553 unbonding_height: "0" 1554 unbonding_time: "1970-01-01T00:00:00Z" 1555 ``` 1556 1557 #### Transactions 1558 1559 The `tx` commands allows users to interact with the `staking` module. 1560 1561 ```bash 1562 simd tx staking --help 1563 ``` 1564 1565 ##### create-validator 1566 1567 The command `create-validator` allows users to create new validator initialized with a self-delegation to it. 1568 1569 Usage: 1570 1571 ```bash 1572 simd tx staking create-validator [path/to/validator.json] [flags] 1573 ``` 1574 1575 Example: 1576 1577 ```bash 1578 simd tx staking create-validator /path/to/validator.json \ 1579 --chain-id="name_of_chain_id" \ 1580 --gas="auto" \ 1581 --gas-adjustment="1.2" \ 1582 --gas-prices="0.025stake" \ 1583 --from=mykey 1584 ``` 1585 1586 where `validator.json` contains: 1587 1588 ```json 1589 { 1590 "pubkey": {"@type":"/cosmos.crypto.ed25519.PubKey","key":"BnbwFpeONLqvWqJb3qaUbL5aoIcW3fSuAp9nT3z5f20="}, 1591 "amount": "1000000stake", 1592 "moniker": "my-moniker", 1593 "website": "https://myweb.site", 1594 "security": "security-contact@gmail.com", 1595 "details": "description of your validator", 1596 "commission-rate": "0.10", 1597 "commission-max-rate": "0.20", 1598 "commission-max-change-rate": "0.01", 1599 "min-self-delegation": "1" 1600 } 1601 ``` 1602 1603 and pubkey can be obtained by using `simd tendermint show-validator` command. 1604 1605 ##### delegate 1606 1607 The command `delegate` allows users to delegate liquid tokens to a validator. 1608 1609 Usage: 1610 1611 ```bash 1612 simd tx staking delegate [validator-addr] [amount] [flags] 1613 ``` 1614 1615 Example: 1616 1617 ```bash 1618 simd tx staking delegate cosmosvaloper1l2rsakp388kuv9k8qzq6lrm9taddae7fpx59wm 1000stake --from mykey 1619 ``` 1620 1621 ##### edit-validator 1622 1623 The command `edit-validator` allows users to edit an existing validator account. 1624 1625 Usage: 1626 1627 ```bash 1628 simd tx staking edit-validator [flags] 1629 ``` 1630 1631 Example: 1632 1633 ```bash 1634 simd tx staking edit-validator --moniker "new_moniker_name" --website "new_webiste_url" --from mykey 1635 ``` 1636 1637 ##### redelegate 1638 1639 The command `redelegate` allows users to redelegate illiquid tokens from one validator to another. 1640 1641 Usage: 1642 1643 ```bash 1644 simd tx staking redelegate [src-validator-addr] [dst-validator-addr] [amount] [flags] 1645 ``` 1646 1647 Example: 1648 1649 ```bash 1650 simd tx staking redelegate cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj cosmosvaloper1l2rsakp388kuv9k8qzq6lrm9taddae7fpx59wm 100stake --from mykey 1651 ``` 1652 1653 ##### unbond 1654 1655 The command `unbond` allows users to unbond shares from a validator. 1656 1657 Usage: 1658 1659 ```bash 1660 simd tx staking unbond [validator-addr] [amount] [flags] 1661 ``` 1662 1663 Example: 1664 1665 ```bash 1666 simd tx staking unbond cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 100stake --from mykey 1667 ``` 1668 1669 ##### cancel unbond 1670 1671 The command `cancel-unbond` allow users to cancel the unbonding delegation entry and delegate back to the original validator. 1672 1673 Usage: 1674 1675 ```bash 1676 simd tx staking cancel-unbond [validator-addr] [amount] [creation-height] 1677 ``` 1678 1679 Example: 1680 1681 ```bash 1682 simd tx staking cancel-unbond cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 100stake 123123 --from mykey 1683 ``` 1684 1685 1686 ### gRPC 1687 1688 A user can query the `staking` module using gRPC endpoints. 1689 1690 #### Validators 1691 1692 The `Validators` endpoint queries all validators that match the given status. 1693 1694 ```bash 1695 cosmos.staking.v1beta1.Query/Validators 1696 ``` 1697 1698 Example: 1699 1700 ```bash 1701 grpcurl -plaintext localhost:9090 cosmos.staking.v1beta1.Query/Validators 1702 ``` 1703 1704 Example Output: 1705 1706 ```bash 1707 { 1708 "validators": [ 1709 { 1710 "operatorAddress": "cosmosvaloper1rne8lgs98p0jqe82sgt0qr4rdn4hgvmgp9ggcc", 1711 "consensusPubkey": {"@type":"/cosmos.crypto.ed25519.PubKey","key":"Auxs3865HpB/EfssYOzfqNhEJjzys2Fo6jD5B8tPgC8="}, 1712 "status": "BOND_STATUS_BONDED", 1713 "tokens": "10000000", 1714 "delegatorShares": "10000000000000000000000000", 1715 "description": { 1716 "moniker": "myvalidator" 1717 }, 1718 "unbondingTime": "1970-01-01T00:00:00Z", 1719 "commission": { 1720 "commissionRates": { 1721 "rate": "100000000000000000", 1722 "maxRate": "200000000000000000", 1723 "maxChangeRate": "10000000000000000" 1724 }, 1725 "updateTime": "2021-10-01T05:52:50.380144238Z" 1726 }, 1727 "minSelfDelegation": "1" 1728 } 1729 ], 1730 "pagination": { 1731 "total": "1" 1732 } 1733 } 1734 ``` 1735 1736 #### Validator 1737 1738 The `Validator` endpoint queries validator information for given validator address. 1739 1740 ```bash 1741 cosmos.staking.v1beta1.Query/Validator 1742 ``` 1743 1744 Example: 1745 1746 ```bash 1747 grpcurl -plaintext -d '{"validator_addr":"cosmosvaloper1rne8lgs98p0jqe82sgt0qr4rdn4hgvmgp9ggcc"}' \ 1748 localhost:9090 cosmos.staking.v1beta1.Query/Validator 1749 ``` 1750 1751 Example Output: 1752 1753 ```bash 1754 { 1755 "validator": { 1756 "operatorAddress": "cosmosvaloper1rne8lgs98p0jqe82sgt0qr4rdn4hgvmgp9ggcc", 1757 "consensusPubkey": {"@type":"/cosmos.crypto.ed25519.PubKey","key":"Auxs3865HpB/EfssYOzfqNhEJjzys2Fo6jD5B8tPgC8="}, 1758 "status": "BOND_STATUS_BONDED", 1759 "tokens": "10000000", 1760 "delegatorShares": "10000000000000000000000000", 1761 "description": { 1762 "moniker": "myvalidator" 1763 }, 1764 "unbondingTime": "1970-01-01T00:00:00Z", 1765 "commission": { 1766 "commissionRates": { 1767 "rate": "100000000000000000", 1768 "maxRate": "200000000000000000", 1769 "maxChangeRate": "10000000000000000" 1770 }, 1771 "updateTime": "2021-10-01T05:52:50.380144238Z" 1772 }, 1773 "minSelfDelegation": "1" 1774 } 1775 } 1776 ``` 1777 1778 #### ValidatorDelegations 1779 1780 The `ValidatorDelegations` endpoint queries delegate information for given validator. 1781 1782 ```bash 1783 cosmos.staking.v1beta1.Query/ValidatorDelegations 1784 ``` 1785 1786 Example: 1787 1788 ```bash 1789 grpcurl -plaintext -d '{"validator_addr":"cosmosvaloper1rne8lgs98p0jqe82sgt0qr4rdn4hgvmgp9ggcc"}' \ 1790 localhost:9090 cosmos.staking.v1beta1.Query/ValidatorDelegations 1791 ``` 1792 1793 Example Output: 1794 1795 ```bash 1796 { 1797 "delegationResponses": [ 1798 { 1799 "delegation": { 1800 "delegatorAddress": "cosmos1rne8lgs98p0jqe82sgt0qr4rdn4hgvmgy3ua5t", 1801 "validatorAddress": "cosmosvaloper1rne8lgs98p0jqe82sgt0qr4rdn4hgvmgp9ggcc", 1802 "shares": "10000000000000000000000000" 1803 }, 1804 "balance": { 1805 "denom": "stake", 1806 "amount": "10000000" 1807 } 1808 } 1809 ], 1810 "pagination": { 1811 "total": "1" 1812 } 1813 } 1814 ``` 1815 1816 #### ValidatorUnbondingDelegations 1817 1818 The `ValidatorUnbondingDelegations` endpoint queries delegate information for given validator. 1819 1820 ```bash 1821 cosmos.staking.v1beta1.Query/ValidatorUnbondingDelegations 1822 ``` 1823 1824 Example: 1825 1826 ```bash 1827 grpcurl -plaintext -d '{"validator_addr":"cosmosvaloper1rne8lgs98p0jqe82sgt0qr4rdn4hgvmgp9ggcc"}' \ 1828 localhost:9090 cosmos.staking.v1beta1.Query/ValidatorUnbondingDelegations 1829 ``` 1830 1831 Example Output: 1832 1833 ```bash 1834 { 1835 "unbonding_responses": [ 1836 { 1837 "delegator_address": "cosmos1z3pzzw84d6xn00pw9dy3yapqypfde7vg6965fy", 1838 "validator_address": "cosmosvaloper1rne8lgs98p0jqe82sgt0qr4rdn4hgvmgp9ggcc", 1839 "entries": [ 1840 { 1841 "creation_height": "25325", 1842 "completion_time": "2021-10-31T09:24:36.797320636Z", 1843 "initial_balance": "20000000", 1844 "balance": "20000000" 1845 } 1846 ] 1847 }, 1848 { 1849 "delegator_address": "cosmos1y8nyfvmqh50p6ldpzljk3yrglppdv3t8phju77", 1850 "validator_address": "cosmosvaloper1rne8lgs98p0jqe82sgt0qr4rdn4hgvmgp9ggcc", 1851 "entries": [ 1852 { 1853 "creation_height": "13100", 1854 "completion_time": "2021-10-30T12:53:02.272266791Z", 1855 "initial_balance": "1000000", 1856 "balance": "1000000" 1857 } 1858 ] 1859 }, 1860 ], 1861 "pagination": { 1862 "next_key": null, 1863 "total": "8" 1864 } 1865 } 1866 ``` 1867 1868 #### Delegation 1869 1870 The `Delegation` endpoint queries delegate information for given validator delegator pair. 1871 1872 ```bash 1873 cosmos.staking.v1beta1.Query/Delegation 1874 ``` 1875 1876 Example: 1877 1878 ```bash 1879 grpcurl -plaintext \ 1880 -d '{"delegator_addr": "cosmos1y8nyfvmqh50p6ldpzljk3yrglppdv3t8phju77", validator_addr":"cosmosvaloper1rne8lgs98p0jqe82sgt0qr4rdn4hgvmgp9ggcc"}' \ 1881 localhost:9090 cosmos.staking.v1beta1.Query/Delegation 1882 ``` 1883 1884 Example Output: 1885 1886 ```bash 1887 { 1888 "delegation_response": 1889 { 1890 "delegation": 1891 { 1892 "delegator_address":"cosmos1y8nyfvmqh50p6ldpzljk3yrglppdv3t8phju77", 1893 "validator_address":"cosmosvaloper1rne8lgs98p0jqe82sgt0qr4rdn4hgvmgp9ggcc", 1894 "shares":"25083119936.000000000000000000" 1895 }, 1896 "balance": 1897 { 1898 "denom":"stake", 1899 "amount":"25083119936" 1900 } 1901 } 1902 } 1903 ``` 1904 1905 #### UnbondingDelegation 1906 1907 The `UnbondingDelegation` endpoint queries unbonding information for given validator delegator. 1908 1909 ```bash 1910 cosmos.staking.v1beta1.Query/UnbondingDelegation 1911 ``` 1912 1913 Example: 1914 1915 ```bash 1916 grpcurl -plaintext \ 1917 -d '{"delegator_addr": "cosmos1y8nyfvmqh50p6ldpzljk3yrglppdv3t8phju77", validator_addr":"cosmosvaloper1rne8lgs98p0jqe82sgt0qr4rdn4hgvmgp9ggcc"}' \ 1918 localhost:9090 cosmos.staking.v1beta1.Query/UnbondingDelegation 1919 ``` 1920 1921 Example Output: 1922 1923 ```bash 1924 { 1925 "unbond": { 1926 "delegator_address": "cosmos1y8nyfvmqh50p6ldpzljk3yrglppdv3t8phju77", 1927 "validator_address": "cosmosvaloper1rne8lgs98p0jqe82sgt0qr4rdn4hgvmgp9ggcc", 1928 "entries": [ 1929 { 1930 "creation_height": "136984", 1931 "completion_time": "2021-11-08T05:38:47.505593891Z", 1932 "initial_balance": "400000000", 1933 "balance": "400000000" 1934 }, 1935 { 1936 "creation_height": "137005", 1937 "completion_time": "2021-11-08T05:40:53.526196312Z", 1938 "initial_balance": "385000000", 1939 "balance": "385000000" 1940 } 1941 ] 1942 } 1943 } 1944 ``` 1945 1946 #### DelegatorDelegations 1947 1948 The `DelegatorDelegations` endpoint queries all delegations of a given delegator address. 1949 1950 ```bash 1951 cosmos.staking.v1beta1.Query/DelegatorDelegations 1952 ``` 1953 1954 Example: 1955 1956 ```bash 1957 grpcurl -plaintext \ 1958 -d '{"delegator_addr": "cosmos1y8nyfvmqh50p6ldpzljk3yrglppdv3t8phju77"}' \ 1959 localhost:9090 cosmos.staking.v1beta1.Query/DelegatorDelegations 1960 ``` 1961 1962 Example Output: 1963 1964 ```bash 1965 { 1966 "delegation_responses": [ 1967 {"delegation":{"delegator_address":"cosmos1y8nyfvmqh50p6ldpzljk3yrglppdv3t8phju77","validator_address":"cosmosvaloper1eh5mwu044gd5ntkkc2xgfg8247mgc56fww3vc8","shares":"25083339023.000000000000000000"},"balance":{"denom":"stake","amount":"25083339023"}} 1968 ], 1969 "pagination": { 1970 "next_key": null, 1971 "total": "1" 1972 } 1973 } 1974 ``` 1975 1976 #### DelegatorUnbondingDelegations 1977 1978 The `DelegatorUnbondingDelegations` endpoint queries all unbonding delegations of a given delegator address. 1979 1980 ```bash 1981 cosmos.staking.v1beta1.Query/DelegatorUnbondingDelegations 1982 ``` 1983 1984 Example: 1985 1986 ```bash 1987 grpcurl -plaintext \ 1988 -d '{"delegator_addr": "cosmos1y8nyfvmqh50p6ldpzljk3yrglppdv3t8phju77"}' \ 1989 localhost:9090 cosmos.staking.v1beta1.Query/DelegatorUnbondingDelegations 1990 ``` 1991 1992 Example Output: 1993 1994 ```bash 1995 { 1996 "unbonding_responses": [ 1997 { 1998 "delegator_address": "cosmos1y8nyfvmqh50p6ldpzljk3yrglppdv3t8phju77", 1999 "validator_address": "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9uxyejze", 2000 "entries": [ 2001 { 2002 "creation_height": "136984", 2003 "completion_time": "2021-11-08T05:38:47.505593891Z", 2004 "initial_balance": "400000000", 2005 "balance": "400000000" 2006 }, 2007 { 2008 "creation_height": "137005", 2009 "completion_time": "2021-11-08T05:40:53.526196312Z", 2010 "initial_balance": "385000000", 2011 "balance": "385000000" 2012 } 2013 ] 2014 } 2015 ], 2016 "pagination": { 2017 "next_key": null, 2018 "total": "1" 2019 } 2020 } 2021 ``` 2022 2023 #### Redelegations 2024 2025 The `Redelegations` endpoint queries redelegations of given address. 2026 2027 ```bash 2028 cosmos.staking.v1beta1.Query/Redelegations 2029 ``` 2030 2031 Example: 2032 2033 ```bash 2034 grpcurl -plaintext \ 2035 -d '{"delegator_addr": "cosmos1ld5p7hn43yuh8ht28gm9pfjgj2fctujp2tgwvf", "src_validator_addr" : "cosmosvaloper1j7euyj85fv2jugejrktj540emh9353ltgppc3g", "dst_validator_addr" : "cosmosvaloper1yy3tnegzmkdcm7czzcy3flw5z0zyr9vkkxrfse"}' \ 2036 localhost:9090 cosmos.staking.v1beta1.Query/Redelegations 2037 ``` 2038 2039 Example Output: 2040 2041 ```bash 2042 { 2043 "redelegation_responses": [ 2044 { 2045 "redelegation": { 2046 "delegator_address": "cosmos1ld5p7hn43yuh8ht28gm9pfjgj2fctujp2tgwvf", 2047 "validator_src_address": "cosmosvaloper1j7euyj85fv2jugejrktj540emh9353ltgppc3g", 2048 "validator_dst_address": "cosmosvaloper1yy3tnegzmkdcm7czzcy3flw5z0zyr9vkkxrfse", 2049 "entries": null 2050 }, 2051 "entries": [ 2052 { 2053 "redelegation_entry": { 2054 "creation_height": 135932, 2055 "completion_time": "2021-11-08T03:52:55.299147901Z", 2056 "initial_balance": "2900000", 2057 "shares_dst": "2900000.000000000000000000" 2058 }, 2059 "balance": "2900000" 2060 } 2061 ] 2062 } 2063 ], 2064 "pagination": null 2065 } 2066 ``` 2067 2068 #### DelegatorValidators 2069 2070 The `DelegatorValidators` endpoint queries all validators information for given delegator. 2071 2072 ```bash 2073 cosmos.staking.v1beta1.Query/DelegatorValidators 2074 ``` 2075 2076 Example: 2077 2078 ```bash 2079 grpcurl -plaintext \ 2080 -d '{"delegator_addr": "cosmos1ld5p7hn43yuh8ht28gm9pfjgj2fctujp2tgwvf"}' \ 2081 localhost:9090 cosmos.staking.v1beta1.Query/DelegatorValidators 2082 ``` 2083 2084 Example Output: 2085 2086 ```bash 2087 { 2088 "validators": [ 2089 { 2090 "operator_address": "cosmosvaloper1eh5mwu044gd5ntkkc2xgfg8247mgc56fww3vc8", 2091 "consensus_pubkey": { 2092 "@type": "/cosmos.crypto.ed25519.PubKey", 2093 "key": "UPwHWxH1zHJWGOa/m6JB3f5YjHMvPQPkVbDqqi+U7Uw=" 2094 }, 2095 "jailed": false, 2096 "status": "BOND_STATUS_BONDED", 2097 "tokens": "347260647559", 2098 "delegator_shares": "347260647559.000000000000000000", 2099 "description": { 2100 "moniker": "BouBouNode", 2101 "identity": "", 2102 "website": "https://boubounode.com", 2103 "security_contact": "", 2104 "details": "AI-based Validator. #1 AI Validator on Game of Stakes. Fairly priced. Don't trust (humans), verify. Made with BouBou love." 2105 }, 2106 "unbonding_height": "0", 2107 "unbonding_time": "1970-01-01T00:00:00Z", 2108 "commission": { 2109 "commission_rates": { 2110 "rate": "0.061000000000000000", 2111 "max_rate": "0.300000000000000000", 2112 "max_change_rate": "0.150000000000000000" 2113 }, 2114 "update_time": "2021-10-01T15:00:00Z" 2115 }, 2116 "min_self_delegation": "1" 2117 } 2118 ], 2119 "pagination": { 2120 "next_key": null, 2121 "total": "1" 2122 } 2123 } 2124 ``` 2125 2126 #### DelegatorValidator 2127 2128 The `DelegatorValidator` endpoint queries validator information for given delegator validator 2129 2130 ```bash 2131 cosmos.staking.v1beta1.Query/DelegatorValidator 2132 ``` 2133 2134 Example: 2135 2136 ```bash 2137 grpcurl -plaintext \ 2138 -d '{"delegator_addr": "cosmos1eh5mwu044gd5ntkkc2xgfg8247mgc56f3n8rr7", "validator_addr": "cosmosvaloper1eh5mwu044gd5ntkkc2xgfg8247mgc56fww3vc8"}' \ 2139 localhost:9090 cosmos.staking.v1beta1.Query/DelegatorValidator 2140 ``` 2141 2142 Example Output: 2143 2144 ```bash 2145 { 2146 "validator": { 2147 "operator_address": "cosmosvaloper1eh5mwu044gd5ntkkc2xgfg8247mgc56fww3vc8", 2148 "consensus_pubkey": { 2149 "@type": "/cosmos.crypto.ed25519.PubKey", 2150 "key": "UPwHWxH1zHJWGOa/m6JB3f5YjHMvPQPkVbDqqi+U7Uw=" 2151 }, 2152 "jailed": false, 2153 "status": "BOND_STATUS_BONDED", 2154 "tokens": "347262754841", 2155 "delegator_shares": "347262754841.000000000000000000", 2156 "description": { 2157 "moniker": "BouBouNode", 2158 "identity": "", 2159 "website": "https://boubounode.com", 2160 "security_contact": "", 2161 "details": "AI-based Validator. #1 AI Validator on Game of Stakes. Fairly priced. Don't trust (humans), verify. Made with BouBou love." 2162 }, 2163 "unbonding_height": "0", 2164 "unbonding_time": "1970-01-01T00:00:00Z", 2165 "commission": { 2166 "commission_rates": { 2167 "rate": "0.061000000000000000", 2168 "max_rate": "0.300000000000000000", 2169 "max_change_rate": "0.150000000000000000" 2170 }, 2171 "update_time": "2021-10-01T15:00:00Z" 2172 }, 2173 "min_self_delegation": "1" 2174 } 2175 } 2176 ``` 2177 2178 #### HistoricalInfo 2179 2180 ```bash 2181 cosmos.staking.v1beta1.Query/HistoricalInfo 2182 ``` 2183 2184 Example: 2185 2186 ```bash 2187 grpcurl -plaintext -d '{"height" : 1}' localhost:9090 cosmos.staking.v1beta1.Query/HistoricalInfo 2188 ``` 2189 2190 Example Output: 2191 2192 ```bash 2193 { 2194 "hist": { 2195 "header": { 2196 "version": { 2197 "block": "11", 2198 "app": "0" 2199 }, 2200 "chain_id": "simd-1", 2201 "height": "140142", 2202 "time": "2021-10-11T10:56:29.720079569Z", 2203 "last_block_id": { 2204 "hash": "9gri/4LLJUBFqioQ3NzZIP9/7YHR9QqaM6B2aJNQA7o=", 2205 "part_set_header": { 2206 "total": 1, 2207 "hash": "Hk1+C864uQkl9+I6Zn7IurBZBKUevqlVtU7VqaZl1tc=" 2208 } 2209 }, 2210 "last_commit_hash": "VxrcS27GtvGruS3I9+AlpT7udxIT1F0OrRklrVFSSKc=", 2211 "data_hash": "80BjOrqNYUOkTnmgWyz9AQ8n7SoEmPVi4QmAe8RbQBY=", 2212 "validators_hash": "95W49n2hw8RWpr1GPTAO5MSPi6w6Wjr3JjjS7AjpBho=", 2213 "next_validators_hash": "95W49n2hw8RWpr1GPTAO5MSPi6w6Wjr3JjjS7AjpBho=", 2214 "consensus_hash": "BICRvH3cKD93v7+R1zxE2ljD34qcvIZ0Bdi389qtoi8=", 2215 "app_hash": "ZZaxnSY3E6Ex5Bvkm+RigYCK82g8SSUL53NymPITeOE=", 2216 "last_results_hash": "47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=", 2217 "evidence_hash": "47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=", 2218 "proposer_address": "aH6dO428B+ItuoqPq70efFHrSMY=" 2219 }, 2220 "valset": [ 2221 { 2222 "operator_address": "cosmosvaloper196ax4vc0lwpxndu9dyhvca7jhxp70rmcqcnylw", 2223 "consensus_pubkey": { 2224 "@type": "/cosmos.crypto.ed25519.PubKey", 2225 "key": "/O7BtNW0pafwfvomgR4ZnfldwPXiFfJs9mHg3gwfv5Q=" 2226 }, 2227 "jailed": false, 2228 "status": "BOND_STATUS_BONDED", 2229 "tokens": "1426045203613", 2230 "delegator_shares": "1426045203613.000000000000000000", 2231 "description": { 2232 "moniker": "SG-1", 2233 "identity": "48608633F99D1B60", 2234 "website": "https://sg-1.online", 2235 "security_contact": "", 2236 "details": "SG-1 - your favorite validator on Witval. We offer 100% Soft Slash protection." 2237 }, 2238 "unbonding_height": "0", 2239 "unbonding_time": "1970-01-01T00:00:00Z", 2240 "commission": { 2241 "commission_rates": { 2242 "rate": "0.037500000000000000", 2243 "max_rate": "0.200000000000000000", 2244 "max_change_rate": "0.030000000000000000" 2245 }, 2246 "update_time": "2021-10-01T15:00:00Z" 2247 }, 2248 "min_self_delegation": "1" 2249 } 2250 ] 2251 } 2252 } 2253 2254 ``` 2255 2256 #### Pool 2257 2258 The `Pool` endpoint queries the pool information. 2259 2260 ```bash 2261 cosmos.staking.v1beta1.Query/Pool 2262 ``` 2263 2264 Example: 2265 2266 ```bash 2267 grpcurl -plaintext -d localhost:9090 cosmos.staking.v1beta1.Query/Pool 2268 ``` 2269 2270 Example Output: 2271 2272 ```bash 2273 { 2274 "pool": { 2275 "not_bonded_tokens": "369054400189", 2276 "bonded_tokens": "15657192425623" 2277 } 2278 } 2279 ``` 2280 2281 #### Params 2282 2283 The `Params` endpoint queries the pool information. 2284 2285 ```bash 2286 cosmos.staking.v1beta1.Query/Params 2287 ``` 2288 2289 Example: 2290 2291 ```bash 2292 grpcurl -plaintext localhost:9090 cosmos.staking.v1beta1.Query/Params 2293 ``` 2294 2295 Example Output: 2296 2297 ```bash 2298 { 2299 "params": { 2300 "unbondingTime": "1814400s", 2301 "maxValidators": 100, 2302 "maxEntries": 7, 2303 "historicalEntries": 10000, 2304 "bondDenom": "stake" 2305 } 2306 } 2307 ``` 2308 2309 ### REST 2310 2311 A user can query the `staking` module using REST endpoints. 2312 2313 #### DelegatorDelegations 2314 2315 The `DelegtaorDelegations` REST endpoint queries all delegations of a given delegator address. 2316 2317 ```bash 2318 /cosmos/staking/v1beta1/delegations/{delegatorAddr} 2319 ``` 2320 2321 Example: 2322 2323 ```bash 2324 curl -X GET "http://localhost:1317/cosmos/staking/v1beta1/delegations/cosmos1vcs68xf2tnqes5tg0khr0vyevm40ff6zdxatp5" -H "accept: application/json" 2325 ``` 2326 2327 Example Output: 2328 2329 ```bash 2330 { 2331 "delegation_responses": [ 2332 { 2333 "delegation": { 2334 "delegator_address": "cosmos1vcs68xf2tnqes5tg0khr0vyevm40ff6zdxatp5", 2335 "validator_address": "cosmosvaloper1quqxfrxkycr0uzt4yk0d57tcq3zk7srm7sm6r8", 2336 "shares": "256250000.000000000000000000" 2337 }, 2338 "balance": { 2339 "denom": "stake", 2340 "amount": "256250000" 2341 } 2342 }, 2343 { 2344 "delegation": { 2345 "delegator_address": "cosmos1vcs68xf2tnqes5tg0khr0vyevm40ff6zdxatp5", 2346 "validator_address": "cosmosvaloper194v8uwee2fvs2s8fa5k7j03ktwc87h5ym39jfv", 2347 "shares": "255150000.000000000000000000" 2348 }, 2349 "balance": { 2350 "denom": "stake", 2351 "amount": "255150000" 2352 } 2353 } 2354 ], 2355 "pagination": { 2356 "next_key": null, 2357 "total": "2" 2358 } 2359 } 2360 ``` 2361 2362 #### Redelegations 2363 2364 The `Redelegations` REST endpoint queries redelegations of given address. 2365 2366 ```bash 2367 /cosmos/staking/v1beta1/delegators/{delegatorAddr}/redelegations 2368 ``` 2369 2370 Example: 2371 2372 ```bash 2373 curl -X GET \ 2374 "http://localhost:1317/cosmos/staking/v1beta1/delegators/cosmos1thfntksw0d35n2tkr0k8v54fr8wxtxwxl2c56e/redelegations?srcValidatorAddr=cosmosvaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qx4cuznf&dstValidatorAddr=cosmosvaloper1vq8tw77kp8lvxq9u3c8eeln9zymn68rng8pgt4" \ 2375 -H "accept: application/json" 2376 ``` 2377 2378 Example Output: 2379 2380 ```bash 2381 { 2382 "redelegation_responses": [ 2383 { 2384 "redelegation": { 2385 "delegator_address": "cosmos1thfntksw0d35n2tkr0k8v54fr8wxtxwxl2c56e", 2386 "validator_src_address": "cosmosvaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qx4cuznf", 2387 "validator_dst_address": "cosmosvaloper1vq8tw77kp8lvxq9u3c8eeln9zymn68rng8pgt4", 2388 "entries": null 2389 }, 2390 "entries": [ 2391 { 2392 "redelegation_entry": { 2393 "creation_height": 151523, 2394 "completion_time": "2021-11-09T06:03:25.640682116Z", 2395 "initial_balance": "200000000", 2396 "shares_dst": "200000000.000000000000000000" 2397 }, 2398 "balance": "200000000" 2399 } 2400 ] 2401 } 2402 ], 2403 "pagination": null 2404 } 2405 ``` 2406 2407 #### DelegatorUnbondingDelegations 2408 2409 The `DelegatorUnbondingDelegations` REST endpoint queries all unbonding delegations of a given delegator address. 2410 2411 ```bash 2412 /cosmos/staking/v1beta1/delegators/{delegatorAddr}/unbonding_delegations 2413 ``` 2414 2415 Example: 2416 2417 ```bash 2418 curl -X GET \ 2419 "http://localhost:1317/cosmos/staking/v1beta1/delegators/cosmos1nxv42u3lv642q0fuzu2qmrku27zgut3n3z7lll/unbonding_delegations" \ 2420 -H "accept: application/json" 2421 ``` 2422 2423 Example Output: 2424 2425 ```bash 2426 { 2427 "unbonding_responses": [ 2428 { 2429 "delegator_address": "cosmos1nxv42u3lv642q0fuzu2qmrku27zgut3n3z7lll", 2430 "validator_address": "cosmosvaloper1e7mvqlz50ch6gw4yjfemsc069wfre4qwmw53kq", 2431 "entries": [ 2432 { 2433 "creation_height": "2442278", 2434 "completion_time": "2021-10-12T10:59:03.797335857Z", 2435 "initial_balance": "50000000000", 2436 "balance": "50000000000" 2437 } 2438 ] 2439 } 2440 ], 2441 "pagination": { 2442 "next_key": null, 2443 "total": "1" 2444 } 2445 } 2446 ``` 2447 2448 #### DelegatorValidators 2449 2450 The `DelegatorValidators` REST endpoint queries all validators information for given delegator address. 2451 2452 ```bash 2453 /cosmos/staking/v1beta1/delegators/{delegatorAddr}/validators 2454 ``` 2455 2456 Example: 2457 2458 ```bash 2459 curl -X GET \ 2460 "http://localhost:1317/cosmos/staking/v1beta1/delegators/cosmos1xwazl8ftks4gn00y5x3c47auquc62ssune9ppv/validators" \ 2461 -H "accept: application/json" 2462 ``` 2463 2464 Example Output: 2465 2466 ```bash 2467 { 2468 "validators": [ 2469 { 2470 "operator_address": "cosmosvaloper1xwazl8ftks4gn00y5x3c47auquc62ssuvynw64", 2471 "consensus_pubkey": { 2472 "@type": "/cosmos.crypto.ed25519.PubKey", 2473 "key": "5v4n3px3PkfNnKflSgepDnsMQR1hiNXnqOC11Y72/PQ=" 2474 }, 2475 "jailed": false, 2476 "status": "BOND_STATUS_BONDED", 2477 "tokens": "21592843799", 2478 "delegator_shares": "21592843799.000000000000000000", 2479 "description": { 2480 "moniker": "jabbey", 2481 "identity": "", 2482 "website": "https://twitter.com/JoeAbbey", 2483 "security_contact": "", 2484 "details": "just another dad in the cosmos" 2485 }, 2486 "unbonding_height": "0", 2487 "unbonding_time": "1970-01-01T00:00:00Z", 2488 "commission": { 2489 "commission_rates": { 2490 "rate": "0.100000000000000000", 2491 "max_rate": "0.200000000000000000", 2492 "max_change_rate": "0.100000000000000000" 2493 }, 2494 "update_time": "2021-10-09T19:03:54.984821705Z" 2495 }, 2496 "min_self_delegation": "1" 2497 } 2498 ], 2499 "pagination": { 2500 "next_key": null, 2501 "total": "1" 2502 } 2503 } 2504 ``` 2505 2506 #### DelegatorValidator 2507 2508 The `DelegatorValidator` REST endpoint queries validator information for given delegator validator pair. 2509 2510 ```bash 2511 /cosmos/staking/v1beta1/delegators/{delegatorAddr}/validators/{validatorAddr} 2512 ``` 2513 2514 Example: 2515 2516 ```bash 2517 curl -X GET \ 2518 "http://localhost:1317/cosmos/staking/v1beta1/delegators/cosmos1xwazl8ftks4gn00y5x3c47auquc62ssune9ppv/validators/cosmosvaloper1xwazl8ftks4gn00y5x3c47auquc62ssuvynw64" \ 2519 -H "accept: application/json" 2520 ``` 2521 2522 Example Output: 2523 2524 ```bash 2525 { 2526 "validator": { 2527 "operator_address": "cosmosvaloper1xwazl8ftks4gn00y5x3c47auquc62ssuvynw64", 2528 "consensus_pubkey": { 2529 "@type": "/cosmos.crypto.ed25519.PubKey", 2530 "key": "5v4n3px3PkfNnKflSgepDnsMQR1hiNXnqOC11Y72/PQ=" 2531 }, 2532 "jailed": false, 2533 "status": "BOND_STATUS_BONDED", 2534 "tokens": "21592843799", 2535 "delegator_shares": "21592843799.000000000000000000", 2536 "description": { 2537 "moniker": "jabbey", 2538 "identity": "", 2539 "website": "https://twitter.com/JoeAbbey", 2540 "security_contact": "", 2541 "details": "just another dad in the cosmos" 2542 }, 2543 "unbonding_height": "0", 2544 "unbonding_time": "1970-01-01T00:00:00Z", 2545 "commission": { 2546 "commission_rates": { 2547 "rate": "0.100000000000000000", 2548 "max_rate": "0.200000000000000000", 2549 "max_change_rate": "0.100000000000000000" 2550 }, 2551 "update_time": "2021-10-09T19:03:54.984821705Z" 2552 }, 2553 "min_self_delegation": "1" 2554 } 2555 } 2556 ``` 2557 2558 #### HistoricalInfo 2559 2560 The `HistoricalInfo` REST endpoint queries the historical information for given height. 2561 2562 ```bash 2563 /cosmos/staking/v1beta1/historical_info/{height} 2564 ``` 2565 2566 Example: 2567 2568 ```bash 2569 curl -X GET "http://localhost:1317/cosmos/staking/v1beta1/historical_info/153332" -H "accept: application/json" 2570 ``` 2571 2572 Example Output: 2573 2574 ```bash 2575 { 2576 "hist": { 2577 "header": { 2578 "version": { 2579 "block": "11", 2580 "app": "0" 2581 }, 2582 "chain_id": "cosmos-1", 2583 "height": "153332", 2584 "time": "2021-10-12T09:05:35.062230221Z", 2585 "last_block_id": { 2586 "hash": "NX8HevR5khb7H6NGKva+jVz7cyf0skF1CrcY9A0s+d8=", 2587 "part_set_header": { 2588 "total": 1, 2589 "hash": "zLQ2FiKM5tooL3BInt+VVfgzjlBXfq0Hc8Iux/xrhdg=" 2590 } 2591 }, 2592 "last_commit_hash": "P6IJrK8vSqU3dGEyRHnAFocoDGja0bn9euLuy09s350=", 2593 "data_hash": "eUd+6acHWrNXYju8Js449RJ99lOYOs16KpqQl4SMrEM=", 2594 "validators_hash": "mB4pravvMsJKgi+g8aYdSeNlt0kPjnRFyvtAQtaxcfw=", 2595 "next_validators_hash": "mB4pravvMsJKgi+g8aYdSeNlt0kPjnRFyvtAQtaxcfw=", 2596 "consensus_hash": "BICRvH3cKD93v7+R1zxE2ljD34qcvIZ0Bdi389qtoi8=", 2597 "app_hash": "fuELArKRK+CptnZ8tu54h6xEleSWenHNmqC84W866fU=", 2598 "last_results_hash": "p/BPexV4LxAzlVcPRvW+lomgXb6Yze8YLIQUo/4Kdgc=", 2599 "evidence_hash": "47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=", 2600 "proposer_address": "G0MeY8xQx7ooOsni8KE/3R/Ib3Q=" 2601 }, 2602 "valset": [ 2603 { 2604 "operator_address": "cosmosvaloper196ax4vc0lwpxndu9dyhvca7jhxp70rmcqcnylw", 2605 "consensus_pubkey": { 2606 "@type": "/cosmos.crypto.ed25519.PubKey", 2607 "key": "/O7BtNW0pafwfvomgR4ZnfldwPXiFfJs9mHg3gwfv5Q=" 2608 }, 2609 "jailed": false, 2610 "status": "BOND_STATUS_BONDED", 2611 "tokens": "1416521659632", 2612 "delegator_shares": "1416521659632.000000000000000000", 2613 "description": { 2614 "moniker": "SG-1", 2615 "identity": "48608633F99D1B60", 2616 "website": "https://sg-1.online", 2617 "security_contact": "", 2618 "details": "SG-1 - your favorite validator on cosmos. We offer 100% Soft Slash protection." 2619 }, 2620 "unbonding_height": "0", 2621 "unbonding_time": "1970-01-01T00:00:00Z", 2622 "commission": { 2623 "commission_rates": { 2624 "rate": "0.037500000000000000", 2625 "max_rate": "0.200000000000000000", 2626 "max_change_rate": "0.030000000000000000" 2627 }, 2628 "update_time": "2021-10-01T15:00:00Z" 2629 }, 2630 "min_self_delegation": "1" 2631 }, 2632 { 2633 "operator_address": "cosmosvaloper1t8ehvswxjfn3ejzkjtntcyrqwvmvuknzmvtaaa", 2634 "consensus_pubkey": { 2635 "@type": "/cosmos.crypto.ed25519.PubKey", 2636 "key": "uExZyjNLtr2+FFIhNDAMcQ8+yTrqE7ygYTsI7khkA5Y=" 2637 }, 2638 "jailed": false, 2639 "status": "BOND_STATUS_BONDED", 2640 "tokens": "1348298958808", 2641 "delegator_shares": "1348298958808.000000000000000000", 2642 "description": { 2643 "moniker": "Cosmostation", 2644 "identity": "AE4C403A6E7AA1AC", 2645 "website": "https://www.cosmostation.io", 2646 "security_contact": "admin@stamper.network", 2647 "details": "Cosmostation validator node. Delegate your tokens and Start Earning Staking Rewards" 2648 }, 2649 "unbonding_height": "0", 2650 "unbonding_time": "1970-01-01T00:00:00Z", 2651 "commission": { 2652 "commission_rates": { 2653 "rate": "0.050000000000000000", 2654 "max_rate": "1.000000000000000000", 2655 "max_change_rate": "0.200000000000000000" 2656 }, 2657 "update_time": "2021-10-01T15:06:38.821314287Z" 2658 }, 2659 "min_self_delegation": "1" 2660 } 2661 ] 2662 } 2663 } 2664 ``` 2665 2666 #### Parameters 2667 2668 The `Parameters` REST endpoint queries the staking parameters. 2669 2670 ```bash 2671 /cosmos/staking/v1beta1/params 2672 ``` 2673 2674 Example: 2675 2676 ```bash 2677 curl -X GET "http://localhost:1317/cosmos/staking/v1beta1/params" -H "accept: application/json" 2678 ``` 2679 2680 Example Output: 2681 2682 ```bash 2683 { 2684 "params": { 2685 "unbonding_time": "2419200s", 2686 "max_validators": 100, 2687 "max_entries": 7, 2688 "historical_entries": 10000, 2689 "bond_denom": "stake" 2690 } 2691 } 2692 ``` 2693 2694 #### Pool 2695 2696 The `Pool` REST endpoint queries the pool information. 2697 2698 ```bash 2699 /cosmos/staking/v1beta1/pool 2700 ``` 2701 2702 Example: 2703 2704 ```bash 2705 curl -X GET "http://localhost:1317/cosmos/staking/v1beta1/pool" -H "accept: application/json" 2706 ``` 2707 2708 Example Output: 2709 2710 ```bash 2711 { 2712 "pool": { 2713 "not_bonded_tokens": "432805737458", 2714 "bonded_tokens": "15783637712645" 2715 } 2716 } 2717 ``` 2718 2719 #### Validators 2720 2721 The `Validators` REST endpoint queries all validators that match the given status. 2722 2723 ```bash 2724 /cosmos/staking/v1beta1/validators 2725 ``` 2726 2727 Example: 2728 2729 ```bash 2730 curl -X GET "http://localhost:1317/cosmos/staking/v1beta1/validators" -H "accept: application/json" 2731 ``` 2732 2733 Example Output: 2734 2735 ```bash 2736 { 2737 "validators": [ 2738 { 2739 "operator_address": "cosmosvaloper1q3jsx9dpfhtyqqgetwpe5tmk8f0ms5qywje8tw", 2740 "consensus_pubkey": { 2741 "@type": "/cosmos.crypto.ed25519.PubKey", 2742 "key": "N7BPyek2aKuNZ0N/8YsrqSDhGZmgVaYUBuddY8pwKaE=" 2743 }, 2744 "jailed": false, 2745 "status": "BOND_STATUS_BONDED", 2746 "tokens": "383301887799", 2747 "delegator_shares": "383301887799.000000000000000000", 2748 "description": { 2749 "moniker": "SmartNodes", 2750 "identity": "D372724899D1EDC8", 2751 "website": "https://smartnodes.co", 2752 "security_contact": "", 2753 "details": "Earn Rewards with Crypto Staking & Node Deployment" 2754 }, 2755 "unbonding_height": "0", 2756 "unbonding_time": "1970-01-01T00:00:00Z", 2757 "commission": { 2758 "commission_rates": { 2759 "rate": "0.050000000000000000", 2760 "max_rate": "0.200000000000000000", 2761 "max_change_rate": "0.100000000000000000" 2762 }, 2763 "update_time": "2021-10-01T15:51:31.596618510Z" 2764 }, 2765 "min_self_delegation": "1" 2766 }, 2767 { 2768 "operator_address": "cosmosvaloper1q5ku90atkhktze83j9xjaks2p7uruag5zp6wt7", 2769 "consensus_pubkey": { 2770 "@type": "/cosmos.crypto.ed25519.PubKey", 2771 "key": "GDNpuKDmCg9GnhnsiU4fCWktuGUemjNfvpCZiqoRIYA=" 2772 }, 2773 "jailed": false, 2774 "status": "BOND_STATUS_UNBONDING", 2775 "tokens": "1017819654", 2776 "delegator_shares": "1017819654.000000000000000000", 2777 "description": { 2778 "moniker": "Noderunners", 2779 "identity": "812E82D12FEA3493", 2780 "website": "http://noderunners.biz", 2781 "security_contact": "info@noderunners.biz", 2782 "details": "Noderunners is a professional validator in POS networks. We have a huge node running experience, reliable soft and hardware. Our commissions are always low, our support to delegators is always full. Stake with us and start receiving your cosmos rewards now!" 2783 }, 2784 "unbonding_height": "147302", 2785 "unbonding_time": "2021-11-08T22:58:53.718662452Z", 2786 "commission": { 2787 "commission_rates": { 2788 "rate": "0.050000000000000000", 2789 "max_rate": "0.200000000000000000", 2790 "max_change_rate": "0.100000000000000000" 2791 }, 2792 "update_time": "2021-10-04T18:02:21.446645619Z" 2793 }, 2794 "min_self_delegation": "1" 2795 } 2796 ], 2797 "pagination": { 2798 "next_key": "FONDBFkE4tEEf7yxWWKOD49jC2NK", 2799 "total": "2" 2800 } 2801 } 2802 ``` 2803 2804 #### Validator 2805 2806 The `Validator` REST endpoint queries validator information for given validator address. 2807 2808 ```bash 2809 /cosmos/staking/v1beta1/validators/{validatorAddr} 2810 ``` 2811 2812 Example: 2813 2814 ```bash 2815 curl -X GET \ 2816 "http://localhost:1317/cosmos/staking/v1beta1/validators/cosmosvaloper16msryt3fqlxtvsy8u5ay7wv2p8mglfg9g70e3q" \ 2817 -H "accept: application/json" 2818 ``` 2819 2820 Example Output: 2821 2822 ```bash 2823 { 2824 "validator": { 2825 "operator_address": "cosmosvaloper16msryt3fqlxtvsy8u5ay7wv2p8mglfg9g70e3q", 2826 "consensus_pubkey": { 2827 "@type": "/cosmos.crypto.ed25519.PubKey", 2828 "key": "sIiexdJdYWn27+7iUHQJDnkp63gq/rzUq1Y+fxoGjXc=" 2829 }, 2830 "jailed": false, 2831 "status": "BOND_STATUS_BONDED", 2832 "tokens": "33027900000", 2833 "delegator_shares": "33027900000.000000000000000000", 2834 "description": { 2835 "moniker": "Witval", 2836 "identity": "51468B615127273A", 2837 "website": "", 2838 "security_contact": "", 2839 "details": "Witval is the validator arm from Vitwit. Vitwit is into software consulting and services business since 2015. We are working closely with Cosmos ecosystem since 2018. We are also building tools for the ecosystem, Aneka is our explorer for the cosmos ecosystem." 2840 }, 2841 "unbonding_height": "0", 2842 "unbonding_time": "1970-01-01T00:00:00Z", 2843 "commission": { 2844 "commission_rates": { 2845 "rate": "0.050000000000000000", 2846 "max_rate": "0.200000000000000000", 2847 "max_change_rate": "0.020000000000000000" 2848 }, 2849 "update_time": "2021-10-01T19:24:52.663191049Z" 2850 }, 2851 "min_self_delegation": "1" 2852 } 2853 } 2854 ``` 2855 2856 #### ValidatorDelegations 2857 2858 The `ValidatorDelegations` REST endpoint queries delegate information for given validator. 2859 2860 ```bash 2861 /cosmos/staking/v1beta1/validators/{validatorAddr}/delegations 2862 ``` 2863 2864 Example: 2865 2866 ```bash 2867 curl -X GET "http://localhost:1317/cosmos/staking/v1beta1/validators/cosmosvaloper16msryt3fqlxtvsy8u5ay7wv2p8mglfg9g70e3q/delegations" -H "accept: application/json" 2868 ``` 2869 2870 Example Output: 2871 2872 ```bash 2873 { 2874 "delegation_responses": [ 2875 { 2876 "delegation": { 2877 "delegator_address": "cosmos190g5j8aszqhvtg7cprmev8xcxs6csra7xnk3n3", 2878 "validator_address": "cosmosvaloper16msryt3fqlxtvsy8u5ay7wv2p8mglfg9g70e3q", 2879 "shares": "31000000000.000000000000000000" 2880 }, 2881 "balance": { 2882 "denom": "stake", 2883 "amount": "31000000000" 2884 } 2885 }, 2886 { 2887 "delegation": { 2888 "delegator_address": "cosmos1ddle9tczl87gsvmeva3c48nenyng4n56qwq4ee", 2889 "validator_address": "cosmosvaloper16msryt3fqlxtvsy8u5ay7wv2p8mglfg9g70e3q", 2890 "shares": "628470000.000000000000000000" 2891 }, 2892 "balance": { 2893 "denom": "stake", 2894 "amount": "628470000" 2895 } 2896 }, 2897 { 2898 "delegation": { 2899 "delegator_address": "cosmos10fdvkczl76m040smd33lh9xn9j0cf26kk4s2nw", 2900 "validator_address": "cosmosvaloper16msryt3fqlxtvsy8u5ay7wv2p8mglfg9g70e3q", 2901 "shares": "838120000.000000000000000000" 2902 }, 2903 "balance": { 2904 "denom": "stake", 2905 "amount": "838120000" 2906 } 2907 }, 2908 { 2909 "delegation": { 2910 "delegator_address": "cosmos1n8f5fknsv2yt7a8u6nrx30zqy7lu9jfm0t5lq8", 2911 "validator_address": "cosmosvaloper16msryt3fqlxtvsy8u5ay7wv2p8mglfg9g70e3q", 2912 "shares": "500000000.000000000000000000" 2913 }, 2914 "balance": { 2915 "denom": "stake", 2916 "amount": "500000000" 2917 } 2918 }, 2919 { 2920 "delegation": { 2921 "delegator_address": "cosmos16msryt3fqlxtvsy8u5ay7wv2p8mglfg9hrek2e", 2922 "validator_address": "cosmosvaloper16msryt3fqlxtvsy8u5ay7wv2p8mglfg9g70e3q", 2923 "shares": "61310000.000000000000000000" 2924 }, 2925 "balance": { 2926 "denom": "stake", 2927 "amount": "61310000" 2928 } 2929 } 2930 ], 2931 "pagination": { 2932 "next_key": null, 2933 "total": "5" 2934 } 2935 } 2936 ``` 2937 2938 #### Delegation 2939 2940 The `Delegation` REST endpoint queries delegate information for given validator delegator pair. 2941 2942 ```bash 2943 /cosmos/staking/v1beta1/validators/{validatorAddr}/delegations/{delegatorAddr} 2944 ``` 2945 2946 Example: 2947 2948 ```bash 2949 curl -X GET \ 2950 "http://localhost:1317/cosmos/staking/v1beta1/validators/cosmosvaloper16msryt3fqlxtvsy8u5ay7wv2p8mglfg9g70e3q/delegations/cosmos1n8f5fknsv2yt7a8u6nrx30zqy7lu9jfm0t5lq8" \ 2951 -H "accept: application/json" 2952 ``` 2953 2954 Example Output: 2955 2956 ```bash 2957 { 2958 "delegation_response": { 2959 "delegation": { 2960 "delegator_address": "cosmos1n8f5fknsv2yt7a8u6nrx30zqy7lu9jfm0t5lq8", 2961 "validator_address": "cosmosvaloper16msryt3fqlxtvsy8u5ay7wv2p8mglfg9g70e3q", 2962 "shares": "500000000.000000000000000000" 2963 }, 2964 "balance": { 2965 "denom": "stake", 2966 "amount": "500000000" 2967 } 2968 } 2969 } 2970 ``` 2971 2972 #### UnbondingDelegation 2973 2974 The `UnbondingDelegation` REST endpoint queries unbonding information for given validator delegator pair. 2975 2976 ```bash 2977 /cosmos/staking/v1beta1/validators/{validatorAddr}/delegations/{delegatorAddr}/unbonding_delegation 2978 ``` 2979 2980 Example: 2981 2982 ```bash 2983 curl -X GET \ 2984 "http://localhost:1317/cosmos/staking/v1beta1/validators/cosmosvaloper13v4spsah85ps4vtrw07vzea37gq5la5gktlkeu/delegations/cosmos1ze2ye5u5k3qdlexvt2e0nn0508p04094ya0qpm/unbonding_delegation" \ 2985 -H "accept: application/json" 2986 ``` 2987 2988 Example Output: 2989 2990 ```bash 2991 { 2992 "unbond": { 2993 "delegator_address": "cosmos1ze2ye5u5k3qdlexvt2e0nn0508p04094ya0qpm", 2994 "validator_address": "cosmosvaloper13v4spsah85ps4vtrw07vzea37gq5la5gktlkeu", 2995 "entries": [ 2996 { 2997 "creation_height": "153687", 2998 "completion_time": "2021-11-09T09:41:18.352401903Z", 2999 "initial_balance": "525111", 3000 "balance": "525111" 3001 } 3002 ] 3003 } 3004 } 3005 ``` 3006 3007 #### ValidatorUnbondingDelegations 3008 3009 The `ValidatorUnbondingDelegations` REST endpoint queries unbonding delegations of a validator. 3010 3011 ```bash 3012 /cosmos/staking/v1beta1/validators/{validatorAddr}/unbonding_delegations 3013 ``` 3014 3015 Example: 3016 3017 ```bash 3018 curl -X GET \ 3019 "http://localhost:1317/cosmos/staking/v1beta1/validators/cosmosvaloper13v4spsah85ps4vtrw07vzea37gq5la5gktlkeu/unbonding_delegations" \ 3020 -H "accept: application/json" 3021 ``` 3022 3023 Example Output: 3024 3025 ```bash 3026 { 3027 "unbonding_responses": [ 3028 { 3029 "delegator_address": "cosmos1q9snn84jfrd9ge8t46kdcggpe58dua82vnj7uy", 3030 "validator_address": "cosmosvaloper13v4spsah85ps4vtrw07vzea37gq5la5gktlkeu", 3031 "entries": [ 3032 { 3033 "creation_height": "90998", 3034 "completion_time": "2021-11-05T00:14:37.005841058Z", 3035 "initial_balance": "24000000", 3036 "balance": "24000000" 3037 } 3038 ] 3039 }, 3040 { 3041 "delegator_address": "cosmos1qf36e6wmq9h4twhdvs6pyq9qcaeu7ye0s3dqq2", 3042 "validator_address": "cosmosvaloper13v4spsah85ps4vtrw07vzea37gq5la5gktlkeu", 3043 "entries": [ 3044 { 3045 "creation_height": "47478", 3046 "completion_time": "2021-11-01T22:47:26.714116854Z", 3047 "initial_balance": "8000000", 3048 "balance": "8000000" 3049 } 3050 ] 3051 } 3052 ], 3053 "pagination": { 3054 "next_key": null, 3055 "total": "2" 3056 } 3057 } 3058 ```