Guide to Aptos

October 17, 2022

Tl;dr.

As the adoption of blockchain technology accelerates, scalability and rapid evolution remain among two of the largest  barriers for the mainstream adoption of web3. 

Aptos is a high-throughput Layer 1 blockchain designed to solve these challenges. According to Aptos, the network can fully utilize all hardware resources available to it with its novel parallelized and pipeline design. Due to its modular architecture, several sharding upgrades will be able to scalably increase network throughput beyond the capabilities of a single machine.

Big-picture context: scalability matters

Blockchain technology has created the foundation for the next upgrade to the internet - web3. This has led to exciting new use cases, from new digital assets (like NFTs), new financial applications, alignment for creators with social media platforms, decentralized finance, storage, identity, and more. Yet, as adoption and usage grows, many blockchains start to face a success problem: networks start to get slower with a backlog of unprocessed transactions, become prohibitively expensive for users, and otherwise face greater risk of outages and security risks. In order for web3 to grow in a sustainable way, it becomes imperative to discover solutions that are capable of handling larger transaction volumes, faster.

Enter Aptos, a blockchain built to address the scalability challenge. Aptos is designed with the principles of usability, scalability, safety, and upgradeability. With a unique parallelized and pipelined approach to transaction processing, the Aptos blockchain is designed to efficiently leverage every hardware resource available to it. Recent execution-only experiments on Aptos demonstrate over 160,000 transactions per second via its Block-STM (Software Transactional Memory) engine.

The tech stack

Let’s take a look at the technology stack that lets Aptos tackle the scalability challenge.

Block-STM (Software Transactional Memory) engine

A multi-threaded, in-memory parallel execution engine for smart contracts that is designed to solve some of the fundamental inefficiencies in smart contract execution today.

The problem today: Smart contract execution is a bottleneck for blockchains. Validators need to propose blocks, agree on their order, and agree on the final state of the network at a given point in time. This process renders transaction execution sequential, and thus not scalable. In addition, transactions can have a number of access conflicts and dependencies (for example, multiple people interacting with a decentralized exchange at the same time). Some blockchains require dependencies to be declared upfront. The problem with that approach is that it limits what a transaction can do. 

In Block-STM, the transactions are pre-ordered and grouped inside a given block while enforcing a deterministic outcome through optimistic execution. (Optimistic execution is when transactions are executed, assuming there are no dependencies.) This preset order, along with the ability to access recordings of memory locations that are modified by the transactions, helps Block-STM dynamically detect dependencies. 

Transactions that access different memory locations can always be executed in parallel. However, during validation, if a transaction is found to have accessed memory locations that were modified by previous transactions, the currently executed transaction is invalidated and then re-executed. Using a novel collaborative scheduler, Block-STM coordinates the validation and execution tasks among threads, and prioritizes the execution and validation of tasks of lower transactions. All of this results in increased execution when multiple processor cores are added depending upon how interdependent the transactions are.

Source: BlockSTM Paper

AptosBFT

Refers to Aptos’ consensus mechanism. Aptos decouples consensus tasks from tasks unrelated to consensus, such as transaction execution and storage. This decoupling allows ordering to occur quickly, as it only uses block metadata and proofs.

Source: Aptos Whitepaper

The protocol operates in a pipeline of rounds. In each round, a leader proposes a new block based on the lead validator’s reputation, calculated by performance and stake. The selected leader then sends a proposal that contains the collected votes of the previous proposal, the leader’s proposed order of the transactions for the new block, and a proposal timestamp. Non-lead validators then vote on the leader’s proposal. Once quorum is reached, rewards are given proportionally to stake and performance as a leader.

AptosBFT provides sub-second finality in the common case and is fault tolerant of up to one-third of malicious validator nodes.

Source: Aptos Whitepaper

Move on Aptos

The Move programming language is a Turing-complete programming language that focuses on safe resource management, access control, and deterministic execution of transactions on the Move Virtual Machine (MoveVM). Each deployment of the MoveVM can be extended using an adapter layer. The Aptos adapter layer exposes features and concepts such as:

  • Parallelism via Block-STM

  • Data being stored within the owner’s account

  • Type safety via generics

  • Resource accounts

  • Contract accounts on other chains

  • Tables for storage of large datasets

In addition, Move ships with many useful libraries, which can be found here

The Move Prover is a formal verifier for contracts written in the Move language. With the verifier, any developer can verify that their code is executing as intended, and check if different scenarios hold for their smart contracts or not while providing additional safeguards. The Move Prover is fast, so developers can integrate it into their workflow and rapidly iterate on their code.

State synchronization

State sync is the process in which non-validating nodes get, verify, and persist data from validators to align on the current state of the blockchain. Aptos believes offering flexible protocols for state sync can support less expensive hardware, boost blockchain performance, security and the user experience. If we take some notable examples of validators crashing, or having slow data propagation upon spinning up, a flexible state sync protocol offers operators the ability to make the best tradeoff for their situation.

The building blocks of Aptos’ state sync protocol include:

  • Persistent storage to defend against potential failures of the machine(s) that host the validators

  • Verifiable blockchain data to prevent malicious actors from modifying the blockchain

  • A root of trust containing a genesis blob, which verifies the first validator set, the initial blockchain state, and recent trusted waypoint such as the current validator state and the current blockchain state

Optimizations to Aptos’ state sync protocol include:

  • State delta syncing to skip transaction execution, which reduces execution costs

  • Blockchain snapshot syncing for peers to download latest blockchain state instead of using state deltas

  • Prefetching data from other peers to defend against network latencies

  • Separation of transaction execution and storage persistence to increase syncing throughput

  • Peer monitoring and reputation to monitor peers for malicious behavior, identify metadata about each peer, and give and maintain a score for each peer

  • Caching commonly requested data to prevent the state sync protocol from doing redundant calculations as more peers try to sync

  • Dynamic pruning to remove any unnecessary data from storage

According to Aptos, with all these optimizations, throughput increased by 5-10x, latency was reduced by 3x, resource requirements were significantly reduced and are used more efficiently, and bootstrapping is significantly faster. 

Source: Evolution of State Sync

The nodes that make it work

There are two types of nodes on Aptos: validator nodes and full nodes.

Validator nodes are responsible for validating and executing transactions, and storing the transaction and execution results on the blockchain. They use the AptosBFT consensus mechanism to agree on the finalized transactions and execution results. 

Aptos does not have built-in delegation. Therefore, you will have to run a validator with the minimum amount of stake or use a liquid staking solution to secure Aptos and earn rewards. However, Aptos makes it easy to build on top of their framework and write a smart contract that does delegation. In addition, only stakers (also called “owners”) and voters can participate in on-chain governance on Aptos. Aptos also gives stakers the ability to designate a voter on their behalf, according to the protocol foundation. 

To note, every staker on Aptos will have their own stake pool.

Full nodes don’t participate in consensus. They are responsible for re-executing all transactions in the history of the Aptos blockchain, and storing the results of these re-executed transactions to local storage. This enables full nodes to challenge any malicious actors. To verify blockchain state, full nodes get the set of transactions and the accumulated hash root of the ledger signed by the validators. They also accept transactions submitted by Aptos clients and forward them to validator nodes.

There are two types of full nodes on Aptos: 

  • Validator full nodes connect directly to validator nodes and offer mitigation from DDos attacks, according to the protocol foundation, and scalability

  • Public full nodes connect to either validator full nodes or other Public full nodes to gain low latency access to the Aptos network.

Validator full nodes and public full nodes exist to take the load from clients and only funnel meaningful transactions to the validator for execution. According to the protocol foundation, validators should primarily focus on execution of transactions and consensus. 

The advantages of running a full node include:

  • Getting notifications about on-chain events

  • Avoiding read traffic

  • Using REST service to interact with Aptos blockchain

  • Running analytics on historical data

Why stake and build with Coinbase Cloud?

Coinbase Cloud offers reliable staking and read/write infrastructure for Aptos. Aptos token holders can run dedicated nodes with Coinbase Cloud to earn rewards and help secure the network. Aptos builders can use our read/write infrastructure to reliably access data from the Aptos blockchain, and build products and services from Day 1. 

  • Protocol expertise: Coinbase Cloud has experience working with the Diem network, also launched by the team behind Aptos, since the project was announced in 2019. We were a founding member of the Diem Association, and a member of the Technical Steering Committee. We ran the first non-Diem validator node on the Diem testnet. Now, we will build on this experience to provide solutions for Aptos builders and token holders, helping the network grow and scale.

  • Reliable infrastructure: Coinbase Cloud’s infrastructure is designed for security and uptime, with competitive SLAs for our customers. 

  • Security: Coinbase Cloud is part of a public company, Coinbase, which upholds high standards for our products quality, reliability, and security.

This document and the information contained herein is not a recommendation or endorsement of any digital asset, protocol, network, or project. However, Coinbase may have, or may in the future have, a significant financial interest in, and may receive compensation for services related to one or more of the digital assets, protocols, networks, entities, projects, and/or ventures discussed herein. The risk of loss in cryptocurrency, including staking, can be substantial and nothing herein is intended to be a guarantee against the possibility of loss.This document and the content contained herein are based on information which is believed to be reliable and has been obtained from sources believed to be reliable, but Coinbase makes no representation or warranty, express, or implied, as to the fairness, accuracy, adequacy, reasonableness, or completeness of such information, and, without limiting the foregoing or anything else in this disclaimer, all information provided herein is subject to modification by the underlying protocol network. Any use of Coinbase’s services may be contingent on completion of Coinbase’s onboarding process and is Coinbase’s sole discretion, including entrance into applicable legal documentation and will be, at all times, subject to and governed by Coinbase’s policies, including without limitation, its terms of service and privacy policy, as may be amended from time to time.