11 min read

Aptos Deep Dive

Focus on scalability, security, and reliability

Cover Image

Published on

14 Mar, 2024

Aptos Deep Dive

Aptos is a Layer-1 blockchain founded in October 2022. It's designed to be scalable, safe, and reliable, utilizing the AptosBFT consensus mechanism and the Move programming language. Aptos' founding was led by ex-Meta employees who, early on, banked funding from the reputable A16z Silicon Valley venture capital firm, and other top web3 investors.

Aptos's use cases include gaming, as it offers a platform for an immersive gaming experience where creators can unlock GameFi opportunities. Creators can also mint NFTs or build Web3-style social media experiences where people keep control over their data.

Aptos continues to gain momentum as we move into 2024 with new DeFi activity. Additionally, Aptos recently announced partnerships with some top data integration providers in February, including Dune Analytics, Nansen, and DappRadar.

The Aptos Foundation also introduced the RaNd0M Hack hackathon for developers to experiment with the Aptos API. RaNd0M Hack has already received over 180 applications, which ends on March 22.

The Aptos Collective

In other recent news, the Aptos Foundation announced that registrations are open for the third cohort of Aptos Collective members. The Aptos Collective is a collaborative platform that brings together passionate community members to contribute to projects within the ecosystem.

This self-titled "beacon of innovation" allows members to network with Aptos Foundation employees and key contributors to the ecosystem. Furthermore, members can compete for prizes while participating in initiatives that will shape Aptos' future.

Node Types

Aptos operates with a Proof of Stake (PoS) consensus mechanism. Furthermore, clients can interact with the blockchain via the different types of nodes listed below:

  1. Validator Nodes participate in consensus and process transactions.

  2. Validator Fullnodes capture and verify the state of the blockchain run by the validator nodes. They work like a public fullnode (below) but can connect directly to validator nodes.

  3. Public Fullnodes can be run by anyone who is not a validator. This type of fullnode doesn't connect directly to a validator node, so it relies upon validator fullnodes for synchronization.

  4. Archival Nodes are fullnodes that store all the blockchain data since the blockchain's inception.

Node Components

Aptos nodes contain the following components:

  1. Mempool

  2. Consensus (not available for fullnodes)

  3. Execution

  4. Virtual Machine

  5. Storage

  6. State synchronizer

Aptos-1.png

Each node has a mempool component that holds in-memory transactions submitted to the blockchain. However, these transactions have yet to be agreed upon or executed.

The consensus component's responsibility is to order blocks of transactions and agree on the execution results. It is accomplished by validator nodes participating with other validator nodes in the consensus protocol.

Execution coordinates the execution of a block of transactions and uses the virtual machine to execute these transactions. It also maintains a transient state. Consensus then votes on this transient state. Execution keeps an in-memory representation of the results until consensus commits the block to the database.

Aptos' virtual machine (VM) runs the Move program within each transaction and determines the execution results. The execution component uses the VM to execute transactions, while a node's mempool uses it to perform verification checks on the transactions.

Storage persists blocks of agreed-upon transactions and their execution results to the local database.

Aptos nodes also contain a state synchronizer. This component has the same functionality for all nodes and keeps them up-to-date with the latest blockchain state.

Validator Nodes on Aptos

The company docs state, "Aptos uses a Byzantine Fault Tolerance (BFT) consensus protocol for validator nodes to agree on the ledger of finalized transactions and their execution results." The flow of transactions is as follows:

A transaction is submitted to the blockchain. Validator nodes run the BFT consensus protocol, execute the transaction, and store it and the execution results on the blockchain. These validator nodes also determine which transactions get added to the blockchain and their order.

For validator nodes to remain up-to-date, they must keep a local copy of the current state of the blockchain and communicate with other validator nodes on the network.

To sum up, validator nodes run the consensus protocol on the Aptos blockchain. The consensus protocol, in turn, agrees on the ordering of transactions.

Aptos Fullnodes

Anyone who desires can run a fullnode. Fullnodes verify blockchain history and act as an external validation resource for transaction history.

Fullnodes receive transactions from peers, may re-execute them, and store the re-executed transaction results locally. With this information, they can challenge and mitigate any potential wrongdoing by validators who might try to modify blockchain history.

Aptos fullnodes can replicate the entire state of the blockchain by synchronizing with other fullnodes or validator nodes. However, while validators and fullnodes use the same code, fullnodes do not participate in consensus.

Validator Fullnodes and Public Fullnodes

The Aptos blockchain has two different types of fullnodes:

  1. Validator fullnodes

  2. Public fullnodes

Aptos-2.png

There's no difference between the functionality of a validator fullnode and a public fullnode. The distinction depends upon whether their upstream node is a validator or another fullnode.

Validator fullnodes connect straight to validator nodes. They offer scalability and mitigate potential DDoS attacks. Public fullnodes connect to validator fullnodes for low-latency access to the network.

Additionally, the Aptos blockchain uses distinct networking stacks, so the validator network is separate from the fullnode network. This factor offers several advantages, including superior support for security preferences and node synchronization.

To stay up-to-date, Aptos nodes sync to the latest state of the blockchain through consensus or state synchronization. Fullnodes only use state synchronization, while validator nodes use state synchronization and consensus.

Move Programming Language

Programming for Web3 requires a massive mindset shift for developers moving to smart contract programming. It involves moving from a world of abundance to a world of constraints. It's a world where optimizing even to the lower levels of opcode to lower gas costs becomes paramount. More importantly, coming to Web3 as a smart contract programmer demands an adversarial mindset. One programming mistake can cost a protocol and its users millions of dollars.

Move was designed with these factors in mind. As a Rust-based, smart programming language, it begins and ends with safety but also has gas metering built into the VM. Move was initially created at Meta to power the Diem blockchain, and some of the people who worked on Diem left to start Aptos.

Unsurprisingly, Aptos smart contracts are called "Move Modules." Most people think of Solidity or Vyper when discussing smart contract programming languages. However, Move has entered the ecosystem, as evidenced by SUI and Aptos, which are different platforms using the Move programming language.

Staking APT Tokens

With PoS in place, anyone who desires to participate in Aptos consensus can do so if they stake sufficiently. For those unfamiliar with the concept, staking involves placing tokens into escrow to help secure the network and earn rewards.

On Aptos, each validator's vote weight is proportional to their stake amount. Likewise, the validator gets rewards proportional to the amount they stake. These rewards align blockchain performance with the validator's interests.

Staking on Aptos supports three personas:

  1. Owner

  2. Operator

  3. Voter

The Aptos model allows for delegations and crypto-staking services like Luganodes to operate. That's because it separates the account owner (that controls the funds) from the other two accounts—operator and voter. Thus, responsibilities can be delegated.

The Owner Persona

An owner persona can stake on the Aptos blockchain and participate in governance. The owner creates an account to obtain the "OwnerCapability" resource. Now, the owner can assign their account's operator address to a trusted node operator, appointing it as a validator. An owner can also designate a voter to participate in governance.

To sum up, the owner:

  • Owns the funds to be used for staking.

  • Has exclusive rights to add, unlock, or withdraw the funds.

  • Can switch the node operator to another at any time.

  • May select the operator commission percentage.

  • Gets the rewards deposited into their account.

The Operator Persona

The owner assigns an operator to run the validator node and receive commissions. The owner also sets the commission. Furthermore, the two personas (owner and operator) can be separate or the same entity.

In sum, the operator:

  • Performs the validator function.

  • Has exclusive permission to join or leave a validator set.

  • Uses the "consensus key" to participate in the consensus process (to vote on and propose blocks).

  • Cannot move the funds (unless the operator is also the owner with the "OwnerCapability" resource).

  • Has their commission deducted from the owner rewards and deposited into the operator's account.

How Validation Works on Aptos

On the Aptos blockchain, an "epoch" is a duration of time in seconds. During that time, validators vote on multiple blocks, the validator set is updated, and rewards are distributed. Additionally, throughout each epoch, the following events occur a multitude of times:

Validator leaders are selected—but not by voting. Instead, a formula based on a validator's reputation, performance, and stake chooses the leader. The designated leader sends a proposal with the collected votes of the previous proposal along with the proposed order of transactions for the new block.

The validators from the validator set will vote on the leader's proposal for the new block, and the block can be finalized after reaching a consensus. Only the leader validator (not the voter validators) gets rewards, which are granted at the end of each epoch. This process repeats when another validator leader is selected.

Validator State and Stake State

States are defined for a validator and for the stake. A validator can be in these four states: inactive, pending_active, active, and pending_inactive. "Inactive" means the validator is not tracked anywhere in the set.

Aptos-3.png

A validator in the active state or pending_inactive state can have their stake in the following four states: inactive, pending_active, active, or pending_inactive.

Validators must stake at least 1 million APT tokens to join a validator set. The APT token is used for governance, transaction fees, and staking within the Aptos ecosystem. The maximum stake is set at 50 million APT.

The critical point is that validators in the active set must keep their stake above the minimum required. Validators whose stake drops below the minimum required will be moved directly to the inactive state during an epoch change. Additionally, governance proposals can also remove validators from the active set.

The Aptos Staking Sequence

To start, the owner initializes the stake pool with the "create-staking-contract." The owner can then deposit the stake themselves or have funds assigned by a crypto-staking service. Luganodes offers efficient staking operations to quickly react to market changes. Moreover, “zero technical challenges” means that owners don’t have to worry about handling the operational difficulties of managing and maintaining a validator node themselves.

The stake gets locked up for a fixed duration as determined by governance and is automatically renewed at the expiration.

Once the validator node is ready to join the set, the node operator can call the "join-validator-set." Changes will only take place in the next epoch. Afterward, the validator begins validating and earning rewards.

A validator can ask to unlock their stake at any point. However, their stake only becomes available to withdraw after their current lockup expires.

Staking Rewards on Aptos

Rewards are distributed to the validators who participated in the previous epoch. Staking rewards are calculated using the formula from the company documents below. Additionally, they accrue as compound interest.

Reward = staked_amount * rewards_rate per epoch * (Number of successful proposals by the validator / Total number of proposals made by the validator)

As mentioned, rewards are paid every epoch, and any validator rewards are added to the staked amount. Thus, the reward at the end of the next epoch will be calculated based on the original stake amount plus the added rewards.

It's important to note that rewards are based on the validator's proposer performance. After getting into a validator set, validators can propose in every epoch. The more successfully a validator proposes, the more rewards they can earn.

Many investors who are not technically oriented or do not have the time to work as validators will choose to use a staking service instead. Crypto-staking firms such as Luganodes remove the complexities for their clients. Furthermore, their experience and expertise will ensure they rank higher in "proposer performance" on Aptos than the uninitiated participants.

The Aptos Blockchain - Conclusion

With its parallel execution engine, the Aptos blockchain excels at high throughput (approximately 160,000 TPS). It also maintains low transaction fees and offers high-level security features built into the Move programming language.

Aptos seeks mass adoption of blockchain technology with its speed, reliability, and ease of use. Those looking to invest can purchase APT outright, participate directly in staking as an owner/operator, or hire a staking service to earn passive income rewards.

About Luganodes

Luganodes is a world-class, Swiss-operated, non-custodial blockchain infrastructure provider that has rapidly gained recognition in the industry for offering institutional-grade services. It was born out of the Lugano Plan B Program, an initiative driven by Tether and the City of Lugano. Luganodes maintains an exceptional 99.9% uptime with round-the-clock monitoring by SRE experts. With support for 40+ PoS networks, it ranks among the top validators on Polygon, Polkadot, Sui, and Tron. Luganodes prioritizes security and compliance, holding the distinction of being one of the first staking providers to adhere to all SOC 2 Type II, GDPR, and ISO 27001 standards as well as offering Chainproof insurance to institutional clients.

Line pattern
© 2024 Luganodes | All rights reserved