APTOS Concepts | Staking


Concept

TIP
We strongly recommend that you read the consensus section of «Transaction Life» before proceeding.

In a distributed system such as blockchain, executing a transaction is different from updating the state of the registry and storing the results in the repository. A quorum of validators must reach agreement, i.e., consensus, on the order of transactions and their results before the results can be stored in the repository and the state of the registry can be updated.

The validator may participate in the consensus process. However, a validator can only get a vote when he or she makes a steak, i.e., puts his or her usable coins into trust. To encourage validators to participate in the consensus process, the weight of each validator’s vote is made proportional to the size of their steak. In exchange, the validator receives a reward proportional to the size of their stake. Thus, the performance of the network, i.e., the consensus, corresponds to the interest of the validator, i.e., the reward.

However, when the validator contributes a very large amount of useful coin as a contingent deposit, this gives him or her enough voting power to control the consensus results. This gives the validator the right to threaten the security of the blockchain network, for example by approving a fraudulent transaction. In the Aptos blockchain, there is a limit to the amount any validator can stake to prevent one validator from becoming a fraudster. Moreover, the stake mitigates such security attacks, since unscrupulous validators must be willing to give up the reward and even the valuation of their assets in order to attack the network.

Thus, staking in the Aptos blockchain promotes consensus while protecting the blockchain network.

The rest of this paper presents how steaking works in the Aptos blockchain.

Stacking in the Aptos blockchain

STACKING AND CONTROL IN APTOS-3
For a step-by-step description of the steaking and voting process, see Steps in AIT-3.

How can a custodian steak on Aptos?
The Aptos Staking module defines an ability that represents ownership. See https://github.com/aptos-labs/aptos-core/blob/0daade4f734d1ba29a896b00d7ddde2249e87970/aptos-move/framework/aptos-framework/sources/configs/stake.move#L85.

This resource OwnerCapability can be used to manage the stake pool. Three personas are supported: owner, operator, and voter. Using this owner-operator-voter model, a custodian can take on the role of the owner and do stacking on the Aptos blockchain and participate in Aptos management. This model allows the creation of delegation and stacking services because the owner can provide funds to the validator and voter personas.

This section describes how this works, using Bob and Alice as examples.

Owner
The owner is the owner of the funds. For example, Bob creates an account on the Aptos blockchain. Bob now has a resource OwnerCapability. Bob can assign his account operator address to Alice, the operator of the trusted node, to designate Alice as the validator.

As owner:

  • Bob owns the funds to be used for steaming.
  • Only Bob can deposit, unlock, or withdraw funds.
  • Only Bob can extend the blocking period.
  • Bob can change Alice node operator to another node operator at any time Bob wants.
  • Rewards will be credited to Bob’s (owner’s) account.

Operator
A node operator is designated by the owner of the fund to manage the validator node. The two personas, owner and operator, can be two different entities or the same entity. For example, Alice (the operator) manages the validator node, acting at the direction of Bob, the fund owner.

As an operator:

  • Alice has rights only to join or leave the validator set.
  • As a validator, Alice will perform a validation function.
  • Alice has rights to change the consensus key and network addresses. The consensus key is used by Alice to participate in the validator consensus process, i.e. to vote and propose a block. Alice is allowed to change («rotate») this key if it is compromised.
  • However, Alice cannot move funds (unless Alice is the owner, i.e. Alice has the OwnerCapability resource.

Voter
The owner can designate a voter. This allows the voter to participate in management. The voter will use the voter key to sign votes for management in transactions.

MANAGEMENT
This document describes staking. For how to participate in the management of the Aptos network using the owner-voter model, see Management.

Joining a validator group

To participate as a validator node in the Aptos network, do the following:

  1. Start a validator node and configure the parameters within the network accordingly.
  2. Contribute your Aptos coins as a steak or have a steaking service do it. The size of the steak must be at least the minimum required amount.
  3. Go through validation and get rewarded.
  4. Your steak is automatically blocked for a certain period of time (set by Aptos management) and automatically reactivated when it expires. You will not be able to withdraw any of the amounts supplied before the lockout period expires. See https://github.com/aptos-labs/aptos-core/blob/00a234cc233b01f1a7e1680f81b72214a7af91a9/aptos-move/framework/aptos-framework/sources/stake.move#L728.

JOINING THE VALIDATOR GROUP
For step-by-step instructions on joining a set of validators, see: Joining a Validator Group.

Minimum and Maximum Steak

To become a member of a validator group, you must have a minimum steak. Furthermore, you may only post up to the maximum amount of a steak.

If at any time after joining the validator set, your current steak amount exceeds the maximum allowed (for example, as rewards are added to your steak amount), your voting rights and rewards will only be calculated using the maximum allowed steak amount, not your current steak amount.

WHEN YOUR STEAK AMOUNT FALLS BELOW THE MINIMUM
If your steak falls below the minimum required amount after joining the validator set at the beginning of an epoch, you will be removed from the validator set. In the current version of slashing on the Aptos blockchain, there is no possibility that your steak will fall below the required minimum before the blockchain period expires. Slashing is not currently supported.

Automatic blockchain period.

When you join a validator group, your steak is automatically blocked for a certain period of time which is set by Aptos management.

Automatic Lockout Period Extension

When your lockout period expires, it will automatically extend so that you can continue to validate and receive rewards.

Unlocking your steak.

You can request to unlock your stake at any time. However, your steak will only become available for withdrawal after your current lock expires. This can be no more than a fixed lockout period.

IS SET BY MANAGEMENT.
The duration of a lockout is determined by Aptos governance, i.e. agreements voted on by members of the Aptos community, not by any special organization such as Aptos Labs.

The era

An epoch in the Aptos blockchain is defined as the period of time, in seconds, during which validators vote for a certain number of blocks, update the validator set, and distribute rewards among validators.

TIP
An epoch in the Aptos blockchain is currently defined as 3,600 seconds (one hour).

Triggers at the beginning of an epoch

TIP
See https://github.com/aptos-labs/aptos-core/blob/0daade4f734d1ba29a896b00d7ddde2249e87970/aptos-move/framework/aptos-framework/sources/configs/stake.move#L862 for the full code.

The following key events are triggered at the beginning of each epoch:

  • Update the validator set by adding pending active validators to the active validator set and removing pending inactive validators from the active validator set.
  • Move any pending active steak to the active steak and any pending inactive steak to the inactive steak.
  • The voting power of the steak pool in this new epoch is updated to the total amount of active steaks.
  • Automatically update the validator lock for validators that will still be in the validator set in the next epoch.
  • Each validator’s vote strength in the validator set is updated to the vote strength of the corresponding steking pool.
  • Rewards are distributed to Validators who participated in the previous epoch.

Rewards

Stacking rewards are calculated using rewards_rate, an annual percentage yield using the following two numbers:

  • Your current total staked amount .
  • Your remaining blocking time.

Rewards are awarded as a compound percentage of your current steak total.

IS SET BY THE CONTROL.
Rewards_rate is set by Aptos management.

Rewards are paid each epoch

Rewards are paid every era. Any reward you earn at the end of the current epoch is added to your steak amount. Rewards at the end of the next epoch are calculated based on the increased steaking amount (i.e., the original steaking amount plus the added reward), and so on.

Reward Formula.

Below is the formula used to calculate rewards:

Reward = Maximum possible reward * (Remaining lockup / Maximum lockup) * (Number of successful votes / Total number of blocks in the current epoch)

Enter fullscreen mode Exit fullscreen mode

Where:

rewards_rate = Maximum possible reward * (Remaining lockup / Maximum lockup)
Enter fullscreen mode Exit fullscreen mode

Consequently, the reward_rate factor will increase as you increase the remaining lock period, and will eventually reach a maximum when the remaining lock period is equal to the maximum lock period.

Rewards use the remaining lock period

As you can see above, the formula for calculating rewards_rate is based on the remaining lock period. For example, if you started with a two-year lockout period, at the beginning your remaining lockout period is two years. After three days (3*24 epochs), your remaining lock period is two years minus three days.

If you do not extend the lockout period, the remaining lockout period will decrease linearly over time and will become zero at the end of two years. In this case, at the end of the two years, your lock-in period will be zero, and therefore you will no longer receive any rewards.

Rewards based on voting results

Your voting results are also used to calculate rewards. Once you hit the number of validators, you can vote in each era. The more consistently you vote, i.e., you vote in each epoch, with no omissions, the more votes you get. This voting power is used to calculate your reward.

For each epoch, your voting efficiency is determined as follows:

  • A running tally of your skipped votes is maintained, validator_missed_votes_counts.
  • The number of votes you successfully cast is calculated as follows:
Total number of successful votes = Total number of blocks in the epoch - Total number of your missed votes in the current epoch
Enter fullscreen mode Exit fullscreen mode

Hence:

Reward = rewards_rate * (Number of successful votes / Total number of blocks in the current epoch)
Enter fullscreen mode Exit fullscreen mode

TIP
The number of missing validator votes has no effect on whether the validator is in the validator set or not. The number of missing votes is only used to calculate the reward using the formula above.

Keeping rewards high

You can prevent rewards from gradually decreasing by regularly extending the lock-in period. You can extend or renew the lock-in period at any time without any permission.

For example, if you lock in assets for two years. After one month, you will receive a slightly lower reward because the remaining lockout period will be less (two years minus one month). However, if you extend the lockout period by one month before the month expires, bringing it to two years, your reward at the end of the month will not decrease because it will be calculated based on the extended lockout period of two years.

TIP
All of your rewards are also subject to the lock-in period because they are added to the original rate amount. Therefore, you will not be able to withdraw your rewards until the lock-in period expires.

EXIT OF VALIDATED BENEFITS

TIP
Check out the Aptos Stake module on Move here: https://github.com/aptos-labs/aptos-core/blob/00a234cc233b01f1a7e1680f81b72214a7af91a9/aptos-move/framework/aptos-framework/sources/stake.move.

At any time you can call the following sequence of functions to leave the validator set:
Call Stake::unlock to unlock the stake amount , and
either call Stake::withdraw to withdraw the cached amount in the next epoch, or call Stake::leave_validator_set.

LEAVING A VALIDATOR SET
For step-by-step instructions on how to leave a validator set, see: Exiting a Validator Set.

Reconnecting to the number of validators

When you leave a set of validators, you can re-join the set by making a deposit of the minimum required amount of steak.

Оцените статью
devanswers.ru
Добавить комментарий