Skip to content
πŸŽ‰ Welcome to the new Aptos Docs! Click here to submit feedback!
Network
Execution

Execution

On Aptos, execution refers to the process where validators run and apply smart contract transactions from an ordered block. The execution output is then applied to the blockchain state.

It is crucial for execution to be deterministic, and all validators should ideally agree on the same final state of the ledger. A majority of validators (more than 2/3 of the validators) must agree on the final state of the ledger in order to come to a consensus. For more detailed information on consensus properties, see the section on BFT and consensus.

Efficient execution, particularly parallel execution, is key to scaling blockchain performance and throughput.

Why Parallel Execution?

The simplest approach for smart contract execution is to execute the transactions in a block sequentially, one at a time. However, this does not scale well. Having a large number of sequential transactions, especially with varying execution times, can cause the latency and throughput of the blockchain to drop drastically.

To solve this problem, blockchains began to adopt parallel execution, or the ability to process multiple transactions in parallel. The challenge with parallel execution, however, is that certain transactions may read or write the same resource, causing conflicts.

Static Parallelism

One approach to address the conflict issue in parallel execution is static parallelism, which requires developers to specify the conflicts between transactions ahead of time. This, however, brings a higher burden on the developer, and in many cases forces transactions that don’t actually conflict to be sequential.

Dynamic Parallelism

Dynamic parallelism computes the execution ordering of transactions on-the-fly, dynamically detecting dependencies and avoiding conflicts during execution. An additional property that is important for dynamic parallelism on a blockchain is that the execution output is consistent with executing transactions according to a preset order.

By not requiring developers to specify the conflicts ahead of time, dynamic parallelism allows developers to flexibly write applications without facing the design constraints of statically declaring transaction dependencies.

Block-STM

Aptos uses a highly efficient, multi-threaded, in-memory parallel execution engine called Block-STM. Block-STM leverages the preset order of transactions and combines Software Transactional Memory techniques with a novel collaborative schedule.

Block-STM is the state-of-the-art dynamic parallelism execution engine developed by the Aptos Labs team.

Since its release, Polygon, Sei, Starknet, and other blockchains have adopted it to achieve parallel execution on their respective chains.

To learn more, see: