Execution reference.

The path one batch takes from the moment it is ordered to the moment its block is sealed, in the order the specification sets it out. Eight headings, in the order a reader needs them.

The API surface A worked ledger

The shape of it

BlockCore is eight shards. Each shard owns a set of accounts, runs sixteen execution lanes and keeps one state root. A batch of up to 2,000 transactions is ordered first, then executed in parallel, then checked, then sealed.

The interesting part is not the parallelism. Executing transactions side by side is a solved problem in the sense that everyone can do it badly. The interesting part is what happens when two lanes want the same account at the same moment, and this page is mostly about that.

A batch arrives unordered

The ordering layer does not try to sort transactions by the accounts they touch. It cannot: the accounts a transaction writes are only known once it runs, and running it is the expensive part. So the batch that reaches a shard is an unordered list, and the shard's job is to make it safe to run.

Four hundred milliseconds are spent here, before any execution begins. That number is a floor, not a target, and it is the largest single term in the finality budget.

Sixteen lanes, and one account each

Each lane takes a share of the batch and runs it against a snapshot of the state. A lane does not see what its neighbours are doing, which is what makes the work parallel and also what makes it dangerous.

Before a transaction is allowed to commit, it declares the accounts it may write. Declarations are cheap and conservative: a caller can claim more than it touches, never less. A lane that declares an account already claimed by another lane is held back rather than rolled back.

The collision

A collision is one account, written by two lanes, in the same batch. Not a conflict of intent: two transactions can legitimately touch the same account in one block, and usually do. A collision only exists because of the order the scheduler chose, and it costs the batch one replay.

Three calls, in orderthe whole mechanism
// 1  dispatch: the batch fans out. No keys are claimed yet.
let ids = scheduler.dispatch(batch);          // 16 lanes

// 2  commit: every lane reports the accounts it wrote.
let plan = scheduler.commit(ids);             // 1 collision, on 0x41f2

// 3  replay: the loser runs again against the committed state.
let again = scheduler.replay(plan.losers[0]);
assert_eq!(again.root, serial.root);          // the same root, always

The last line is the whole guarantee. Whatever the scheduler decides, replaying the batch serially produces the same state root. If it does not, the block is discarded.

The loser re-executes

The held transaction waits for the winning lane to commit, then runs again against the state that commit produced. It is charged once for the gas it used, and the receipt names the lane that finished the work rather than the lane that started it.

A replay is not free, but it is short: the held transaction has already been decoded and its declarations are known. The specification budget puts one replay at 1.2 ms, the same as one lane's share of the batch.

Finality in two parts

Ordering consensus takes 400 ms and is the same for every block. Execution takes however long the batch needs, and is the term that moves when you change the load. The median block settles in 762 ms; under the heaviest batch the interface allows, the figure passes 800 ms and the status page marks it.

A block is final when two thirds of staked CORE has signed the checkpoint that contains it. Nothing is reverted after that point, which is why the site quotes a count of reverted checkpoints and why that count is zero.

Eight shards, chosen by account

A transaction is routed to the shard that owns the account it writes, not the shard that received it. Two accounts in the same shard settle between themselves and never involve the rest of the network.

When a transaction genuinely has to cross, it becomes a message: ordered like any other transaction, settled like any other transaction, and charged 41,000 gas instead of 21,000.

Everything the spec fixes

These are the numbers the rest of the site computes from. Change one and the interface on the overview page changes with it.

Constantsas written
Execution lanes per shard
16
Shards
8
Transactions per batch
2,000
Ordering consensus
400 ms
One lane's share of a batch
1.2 ms
One replay
1.2 ms
Median finality
762 ms
Quorum to finalise
62.5%
Validators
1,438
Gas for a transfer
21,000
Gas for a cross shard message
41,000
Unit of account
CORE

Two machines, one rule book.

A substation turns one supply into many circuits and keeps them isolated. A hall of cabinets runs thousands of processes and keeps them isolated. The specification is about the second problem, and the first one is where the habit comes from.

A power transformer and switchgear inside a fenced substation
Muurame substation, Finland. Antti Leppänen, CC BY 4.0, via Wikimedia Commons.
Rows of illuminated server cabinets in a colocation hall
BalticServers data center. BalticServers.com, CC BY-SA 3.0, via Wikimedia Commons.