How does Aptos run transactions in parallel with Block-STM? · Jumpstart Blockchain
How does Aptos run transactions in parallel with Block-STM?
Block-STM executes a block's transactions optimistically on many threads, records what each read and wrote, and re-executes any that read stale data, in preset order, so results match serial execution. Hot keys still serialise.
Block-STM is the parallel execution engine of Aptos. It runs all of a block's transactions optimistically on many threads at once, with no up-front declaration of what each one touches. Every execution records a read set and a write set in a multi-version data structure; a validation step then checks that each transaction's reads are still the values the transactions before it in the block wrote. Any transaction that read stale data is aborted and re-executed, and its old writes are marked as estimates so later transactions wait for it instead of wasting work. Because everything is resolved against the block's preset order, the result is identical to running the block sequentially. For developers, the only visible effect is performance: transactions that all write the same state, such as a global counter, can't run in parallel, which is why Aptos provides aggregators.
Why is parallel execution hard?
Two transactions can run at the same time safely only if neither writes something the other reads. Blockchains handle that in one of two ways:
Approach
How conflicts are handled
Examples
Declared access
Each transaction lists the state it will touch; the scheduler only runs disjoint ones together
Solana, Sui owned objects
Optimistic
Run everything, track what was actually read and written, redo conflicts
Aptos Block-STM, Sei v2, Monad
Declared access is cheap to schedule but pushes work onto developers and clients: on Solana, every instruction has to name its accounts, as described in how Solana programs and PDAs work. Optimistic execution needs no declarations, which suits smart contracts whose storage keys depend on runtime values. The challenge is keeping wasted work low and the result deterministic.
Block-STM comes from software transactional memory (STM), a decades-old idea for concurrent programs. Its key insight, set out in the 2022 paper by Gelashvili and colleagues from the Diem and Aptos teams, is that blockchains have something ordinary STM doesn't: a . Consensus has already decided that transaction 5 comes before transaction 6. So the engine never has to decide who wins a conflict. The lower index always does.
fixed order agreed before execution
How does Block-STM work?
Multi-version memory
Instead of one value per storage key, Block-STM keeps a version of each key per transaction that wrote it during this block. When transaction j reads a key, it gets the value written by the highest-indexed transaction below j that wrote that key, or the value from storage if none did. It records which version it read, keyed by transaction index and incarnation number (how many times that transaction has been executed).
Execution and validation
Each transaction goes through two kinds of task:
Execute. Run the Move code against multi-version memory, collecting the read set (key and version read) and write set (key and new value). Writes are published to multi-version memory immediately, so higher transactions can see them.
Validate. Re-read every key in the read set. If any now resolves to a different version, because a lower transaction wrote it after this one ran, validation fails.
A failed validation aborts that incarnation. Its writes stay in memory but are flagged as ESTIMATE, and the transaction is scheduled to execute again as incarnation n + 1. If a higher transaction later reads a key marked ESTIMATE, it doesn't guess: it pauses and registers a dependency, and resumes once the lower transaction has re-executed. That cheap heuristic avoids cascades of transactions executing against values that are about to change.
The collaborative scheduler
There is no central coordinator handing out work. Worker threads share two counters: the next transaction to execute and the next to validate. Each thread repeatedly takes whichever task has the lower index, so work near the start of the block, which everything else depends on, is always finished first. When a transaction re-executes and writes to a new key, every higher transaction needs revalidation, so the validation counter is pulled back.
The block is done when every transaction has executed and passed validation with no outstanding tasks. At that point the latest writes in multi-version memory are exactly the sequential result, and they are committed to storage. Production Aptos commits transactions on a rolling basis as the prefix of the block is settled, rather than waiting for the whole block.
A small example
Take four transfers in one block:
Index
Transaction
Reads and writes
T1
Alice pays Bob
Alice, Bob
T2
Carol pays Dave
Carol, Dave
T3
Bob pays Erin
Bob, Erin
T4
Frank pays Grace
Frank, Grace
With four threads, all four execute at once. T3 may read Bob's balance before T1 has written it, so it sees storage's value. T1, T2 and T4 validate. T3 fails validation, because Bob now has a version from T1, and re-executes as incarnation 1 against T1's output. Final cost: five executions instead of four, in roughly the time of two. The result matches running T1 to T4 in order.
How fast is it?
The Block-STM paper reported up to about 170,000 transactions per second on Aptos benchmarks with 32 threads, around 17 times a sequential baseline, and up to about 80,000 tps on a deliberately contended workload. Those are execution-engine benchmarks on simple transfers, not network throughput; real blocks also spend time on consensus, signature verification and storage, and real workloads vary. The useful takeaway is that throughput degrades gracefully with contention: in the worst case, where every transaction conflicts with the previous one, Block-STM behaves close to sequential execution instead of collapsing.
Aptos has continued to develop the engine. It announced a redesigned Block-STM v2 in 2025 aimed at scaling to more cores, which reports in 2026 describe as running by default on mainnet. The guarantees in this article (preset order, optimistic execution, deterministic output) are unchanged; check Aptos's own documentation for the current implementation details.
Where does the parallelism disappear?
Correctness never depends on contention, but throughput does. If every transaction in a block reads and writes the same storage key, each must wait for the one before it. Common culprits on Aptos:
Global counters: total minted, number of users, next order ID.
Single shared pools: every swap on one AMM pool writes its reserves, so heavy trading on one pair serialises, as it would on any chain.
Length-tracking collections: a TableWithLength or vector stored in one resource and written by every user.
Legacy event handles: the old EventHandle kept a sequence counter that every emitted event incremented. Module events, emitted with event::emit from a struct marked #[event], have no counter and are what new code should use.
Many hot writes are additions and subtractions whose exact intermediate values nobody needs. Aptos's aggregators exploit that. An Aggregator records each transaction's change as a delta (+1, -5) instead of a read-modify-write, and Block-STM applies the deltas in order at commit time. Two transactions that each add 1 no longer conflict.
module my_addr::mint_stats {
use aptos_framework::aggregator_v2::{Self, Aggregator};
struct Stats has key {
minted: Aggregator<u64>,
}
fun init_module(admin: &signer) {
move_to(admin, Stats { minted: aggregator_v2::create_unbounded_aggregator<u64>() });
}
/// Called from this package's mint function. Parallel-friendly: a delta, not a read.
public(package) fun record_mint() acquires Stats {
let stats = borrow_global_mut<Stats>(@my_addr);
aggregator_v2::add(&mut stats.minted, 1);
}
#[view]
public fun minted(): u64 acquires Stats {
aggregator_v2::read(&borrow_global<Stats>(@my_addr).minted)
}
}
The equivalent with a plain count: u64 field (stats.count = stats.count + 1) works too, but every mint in a block would then conflict with every other.
The rules that keep aggregators fast:
Use add, sub, try_add and try_sub. A bounded aggregator (create_aggregator(max)) makes try_add return false at the limit, which is how capped supplies stay parallel.
Avoid read inside transactions that also modify the aggregator. The framework's own documentation warns that reading prevents speculative parallelism for that transaction. Reading in a #[view] function is fine.
When you need the value in output, for example to number an NFT, take a snapshot or build a derived string with derive_string_concat instead of reading. The value is filled in at commit time.
The Aptos framework uses the same machinery for concurrent fungible asset supply and for parallel-friendly collection counters in the Digital Asset standard, which is one reason new token code should use the object-based Fungible Asset standard rather than the older coin module. For the broader object model, see how Move on Aptos and Sui differs from Solidity.
What should Aptos developers do differently?
Keep state per user. Store data in each user's account or in objects they own, rather than in one global resource every transaction mutates.
Turn counters into aggregators. Supply, totals and IDs are the usual hot spots.
Use module events.#[event] structs with event::emit, not event handles.
Shard unavoidable hot spots. If one pool or vault must be shared, consider several instances, for example per market or per bucket, and aggregate off-chain.
Don't rely on ordering within a block for fairness. Block-STM preserves the agreed order exactly, so ordering is decided by consensus and fees, not by execution.
Load-test with realistic contention. A contract that is fast with ten users can serialise at ten thousand if all of them write one key.
Summary
Piece
Role
Preset order
Consensus fixes the order, so conflicts always resolve in favour of the lower index
Multi-version memory
Each transaction reads the latest write from a lower-indexed transaction
Read and write sets
Recorded during speculative execution, checked during validation
ESTIMATE markers
Make dependent transactions wait instead of executing on stale data
Collaborative scheduler
Threads take the lowest-index execution or validation task
Aggregators
Turn commutative counters into deltas so they don't conflict
Block-STM makes parallelism invisible to correctness and visible only in performance. Write Move as if execution were sequential, then remove the shared writes that would force it to be.