← Academy library

Crypto / Evergreen

Transaction ordering can break assumptions in contract logic

Publicly visible pending transactions can reveal intended actions before execution, allowing other participants to submit transactions that change the relevant state first.

THE IDEA TO KEEP

Ordering risk is a design problem when valuable information can be copied before the contract assigns its benefit.

The distinction that matters

Publicly visible pending transactions can reveal intended actions before execution, allowing other participants to submit transactions that change the relevant state first. Smart-contract security combines software correctness, authorization, and economic assumptions. A program can follow its written code perfectly while producing an outcome its designers did not intend. Attackers can choose inputs, arrange transactions, interact through other contracts, and exploit the precise order in which state changes and external calls occur.

How the mechanism works

A contract is vulnerable when its economic or authorization assumptions depend on an ordering that the sender cannot guarantee. Public code makes behavior inspectable, but inspection requires attention to all reachable paths and dependencies. Security reviews, formal methods, tests, and monitoring provide different kinds of evidence. None is a universal certificate covering every later upgrade, configuration change, or interaction with external systems. A review's scope, version, and unresolved findings matter, and a deployed contract can differ from the reviewed artifact.

A worked situation

Consider this hypothetical situation: A hypothetical application offers a reward to the first caller who submits a publicly revealed solution without binding the reward to the original solver. An observer can copy the solution and compete for earlier inclusion, potentially receiving the reward despite not doing the underlying work.

Where interpretation can fail

Increasing the fee may alter the race but does not fix a design that exposes an unbound valuable action. Examine whether commit-reveal schemes, sender binding, or other contract-level constraints protect the intended ownership of the action. Ordering risk is a design problem when valuable information can be copied before the contract assigns its benefit.

The wider technical implication

A commit-reveal design can hide a valuable input until a later step, but it needs rules binding the reveal to the original committer and handling deadlines, non-reveals, and copying. Otherwise, the reveal itself may remain exploitable. The approach also creates an extra transaction and waiting stage, which changes usability and availability. The right lesson is not that one named pattern solves all ordering problems. It is that the contract must assign rights to information in a way that survives public visibility and adversarial ordering under the actual execution model.

A global perspective

A technical exploit, contractual breach, and regulatory violation are different classifications. Remedies and reporting duties depend on jurisdiction and the actual facts.

Sources & further reading

Ethereum.org — Smart contract security ↗OpenZeppelin Contracts — Access control ↗

Sources checked Oct 27, 2026. Educational examples. Historical observations are attributed to their sources. No affiliation with cited organizations.

Make the idea stick.

Mark complete when you are ready. Reaching the end alone does not mark a lesson complete.

What assumption in this guide would change the result in a different situation? Revisit the example and explain that change in your own words.

Explore crypto →

KEEP THE CONNECTION

Your next useful question.

Your saved guides →