Latest

Understanding the Aptos Project Staking (APT) Mechanism in Modern Blockchain Technology

Modern Tier 1 blockchain may have increased throughput compared to earlier cryptocurrencies. Let’s take a closer look at how Aptos Project Steaking (APT) works.

Steaking

In a distributed data registry, such as blockchain, the mechanism for performing a transaction is different from the mechanism for updating the registry itself and storing the results in it.

Consensus on transactions and results must be reached by a quorum of validators before those results can be stored and the registry updated;

Anyone can participate in the Aptos consensus process if they bid enough coins by placing them in escrow.

To develop a mechanism for “encouraging” validators to participate in the consensus process and, consequently, to deposit, the weight of each validator’s vote in the system is set as proportional to the amount posted.

The validator also receives remuneration in proportion to this amount. Consequently, the performance of the entire blockchain is in the interest of the validator.

Note: At the time of writing, slashing has not been implemented in the system. Additional resources and supporting documentation can be found here.

The current blockchain data can be found in staking_config::StakingConfig. The configuration set is defined in staking_config.move.

Stacking in the Aptos blockchain

The staking model in the Aptos blockchain defines the properties of “ownership” provisioning in the system.

The OwnerCapability resource can be used to manage the steaking pool. The system as a whole takes part:

  • Owner,
  • Operator,
  • Voter.

Using the owner-operator-voter model, a custodian agent can take on the role of the owner, bid on the Aptos blockchain and participate in governance in the system.

This model allows for the creation of delegation and stacking services, due to the separation of the account managing the funds from other accounts (specifically the operator, the voter), which ultimately allows for secure delegation of responsibilities.

Let’s break down how this works, using Bob and Alice as examples.

Owner

The “owner” is the participant who owns the money. Let’s say a certain Bob creates an account in the Aptos blockchain.

It now has an OwnerCapability resource. Bob can designate the address of the Alice account, the operator of the trusted node, to be the operator of his account, to make it a “validator”.

As owner:

  • Bob owns the funds to be used for steaking.
  • Only Bob can add, unlock or withdraw funds.
  • Only Bob can extend the lock period.
  • Bob can change node operator Alice to any other node operator at any time he wishes to do so.
  • Bob can set the percentage of commission to the operator.
  • The reward will be credited to Bob’s account.

Operator

The owner of the funds appoints the operator of the node (node), and the latter receives the commission set by the owner.

The two participants, the “owner” and the “operator,” can be two independent or identical agents. For example, the operator Alice runs a validator node operating at the behest of Bob, the fund owner.

As operator:

  • Alice only has rights to join and leave validation settings.
  • As a “validator”, Alice will act as a “checker”, that is, a validation (validity).
  • Alice has permissions to change the consensus key and network addresses. The consensus key is used by Alice to participate in the validator’s consensus process, that is, to vote and propose a block. Alice is allowed to change this key in case the key is compromised.
  • Alice cannot move funds themselves (unless Alice is the owner, which means she has OwnerCapability).
  • The operator’s commission is deducted from the staker’s (owner’s) remuneration and credited to the operator’s account.

Voter

The owner can set the voter. This will allow the voter to participate in governance. The voter will use a “voting key” to sign managerial votes in transactions.

This document presents the Governance section of the. Explore it to understand how to participate in Aptos network management using the owner-voter model.

Confirmations in the Aptos blockchain

As an epoch runs through, the next stream of events happens thousands of times:

  1. The validation leader is determined in a deterministic way by a formula that is based on the validator’s reputation as determined by his or her activity (including whether or not the validator has participated in voting in the past) and the steak. The leader is selected without the use of a vote.
  2. The chosen leader sends a proposal that contains the collected quorum votes from the previous proposal and the leader’s declared transaction order for the new block.
  3. All validators in the validator group will vote on the leader’s proposal for the new block. If consensus is reached, the block can be completed. Thus, the real number of votes to reach consensus is a certain number of validators from the validator group. The validation leader is awarded. The awards are for him only, not for the voting validators.
  4. The process above is repeated for the next block, changing only the validation leader. Rewards are given out at the end of an era.

Validator and Rate Status

Status is defined for both the validator and the bid.

Validator state: The validator can be in any of four states. Moreover, it can go from an inactive state (where it cannot be tracked in the validator group) to any of the other three states:

  • inactive;
  • pending activation;
  • active;
  • pending deactivation.

Rate state: A validator in either the active or pending activation states can have one of the following four states:

  • inactive;
  • pending activation;
  • active;
  • pending deactivation.

These states are relevant for a group of validators who add or remove their own rates.

Validator states.

There are two extreme cases to consider:

  1. If the validator rate falls below the required minimum, that validator will be switched from active to inactive right during the epoch change. It only happens during a change of era.
  2. The Aptos control can also directly translate validators from the active state. It should be noted that governance proposals cause shifts in the era.

The State of the Stakes

Rate status is more detailed than validator status; an additional rate can be added and a portion of the active validator rate removed.

A set of rules for the validator

The list below applies during state changes:

  1. The strength of the voice can only change (increase or decrease) at the edge of epochs.
  2. The validator consensus key and the network addresses of the validator and its full node can only change on the epoch boundary.
  3. A pending deactivation bid cannot be put into an inactive state (and therefore become available for withdrawal) until the lock time expires.
  4. All validators in an active validator group cannot have a rate less than the set size.

Validator Action Algorithm

Please review Staking pool operations for the correct sequence of commands in the algorithm below.

  1. The owner initializes the staking pool with “aptos stake initialize-stake-owner”.
  2. When the owner is ready to place a stake (or receive funds, in exchange for the opportunity to own), the owner calls “aptos stake add-stake”.
  3. When the validator node is ready, the operator can call “aptos node join-validator-set”, to join the active validator group. The changes will take effect in the next era.
  4. Validator checks (offers blocks as validator leader) and receives reward. The rate will automatically be locked in for a fixed term and automatically renewed when it expires.
  5. At any time if an operator wants to update the consensus key or validator network addresses, they can invoke “aptos node upd ate-consensus-key” or “aptos node upd ate-validator-network-address”. Changes to the consensus key or network addresses also only take effect in the next era.
  6. A validator can request to unlock their share at any time. However, its rate will become available for withdrawal only after the current blocking period expires. This can go on up to a fixed length of time for blocking.
  7. After leaving, the validator can either leave the validator group by calling “aptos node leave-validator-se t” or, if their rate falls below the required minimum, they will be removed at the end of the epoch.
  8. A validator can always join a validator group by re-running steps 2-3.
  9. The owner can always change operators by calling “aptos stake se t-operator”.
  10. The owner can always change the designated voter by calling “aptos stake set-delegated-voter”.

Joining a validator group

Joining as a validator in the Aptos network works as follows:

  1. The operator starts a “validator node”, sets up the validator network address chain, and changes the consensus key.
  2. Owner contributes his Aptos coins as a bet or has funds delegated by the stacking service. The rate must meet the minimum set amount.
  3. The validator node cannot be synchronized until the staking pool is active.
  4. The operator confirms and receives rewards.
  5. The steaking pool will be automatically locked for a fixed time, which is set by Aptos management, and will be automatically renewed after it expires. You will not be able to withdraw any part of your bet until the blocking time expires. Read more here.
  6. The operator will have to wait for the new era to happen before the validator becomes active.

Follow this link for step-by-step instructions on how to join the validator group.

Minimum and maximum rates

To join a validator group, your rate must be at least the specified minimum. Moreover, the upper threshold of entry is also limited. The current set minimum for steaking is 1 million APT tokens.

If at any time after joining a validator group, your stake exceeds the maximum allowable value (for example, because of rewards that will be added to your stake).

The strength of your vote and rewards will only be calculated using the maximum allowable stake, not the number of coins you have in your hand.

Owners may withdraw a portion of their bet and leave their balance below the required minimum. In this case, their stacking pool will be removed from the validator group at the start of the new era;

Duration of automatic blocking

When you join a validator group, your bet will be automatically locked for a certain amount of time, which is set by Aptos management.

Automatic lockout update

When your lock period expires, it will be automatically renewed so that you can continue to confirm transactions and earn rewards.

Unlock your bet

You can request to unlock your bet at any time. However, your bet can only be withdrawn when the current blocking time expires. The longest blocking duration is fixed.

You will continue to receive rewards as long as your bet cannot be withdrawn.

The principal amount is updated when you do any of the following:

  1. Operator requests unlocking of commissions.
  2. Staker (owner) withdraws his funds.
  3. Staker (owner) changes operators.

When Staker unlocks a bet, it will also unlock commissions. Full commission for any earned rewards unlocked.

It is not proportional to the unlocked rate. The commission is distributed to the operator after the end of the blocking, when the second commission request occurs or when the staker withdraws (distributes) the unblocked bet.

Resetting a lock

When a lock period expires, it is automatically renewed by the network. However, the owner can reinstall it directly himself.

Lockout times are set by Aptos governance, which are agreements voted on by members of the Aptos community, not special entities like Aptos Labs.

The Age of

An epoch in the Aptos blockchain is defined as the time, expressed in seconds, during which validators vote for a certain number of blocks, the validator group is updated and rewards are distributed among validators.

The epoch on the main Aptos network is set at 7,200 seconds (two hours).

Triggers at the beginning of the epoch

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

  1. Updates the validator group by adding pending validators to the pool of active validators and removing pending validators from the pool of active validators.
  2. Move all validators pending activation to active and all validators pending deactivation to inactive.
  3. The number of staking pool votes in this epoch is updated to the size of the total active stakes.
  4. Automatic validator lock updates for those who remain in the validator pool even in the new epoch.
  5. Each individual validator’s vote strength in the group is updated to match the total number of votes in the pool.
  6. Awards are distributed to validators who participated in the previous epoch.

For more information about triggers in new epochs, see stake.move.

Awards

Rewards for staking are calculated using:

  1. Reward Rates, Annual Percentage Yield (APY). That is, the rewards accrue as a compound percentage of your current bet.
  2. The amount of coins you lock for steaking.
  3. Your performance offerings in Aptos management.

The award rate is set by Aptos management. You can also take a look at the validation section in Aptos.

The Reward Formula

Below is the formula used to calculate rewards for validators:

Reward = your rate * the reward rate for a particular epoch * (number of successful validator offers/total number of offers made by the validator).

Rewards payable each epoch

Rewards are paid each epoch. Each reward you (i.e., the validator) earn at the end of the current epoch is added to your rate.

The reward at the end of the next epoch is calculated based on your increased rate (i.e. the original rate plus the reward from the previous epoch) and so on.

Rewards based on supply performance

Calculating rewards for validators uses their supply performance. Once in a validator group, you can make offers in any era.

The more successful your bids, that is, the more they go through, the bigger the reward you get.

Remember that the rewards are only for the validator leader, that is, the validator who proposes the new block, not the validators who will vote on the leader’s proposal.

All validator awards are subject to temporary blocking as they are added to the original stakes.

Withdrawing from the Validator Group

At any time, you can invoke the following sequence of functions to leave a validator group:

  • Call Stake:unlock, to unlock your bid,
  • Call Stake:withdraw to withdraw your bet to the next epoch, or call Stake:leave_validator_set to leave the validator pool.

You can read more about the Stake module in Aptos in Move at this link.

Re-joining the validator pool

When you leave the validator pool, you can join again with a minimum bid.

Related Documentation

  • Current network data;
  • Stacking pool operations;
  • delegated pool operations;
  • configuration file;
  • staking_contract.move file;
  • other staking-related files.