Atomicity

The property ensuring a transaction either completes fully or doesn't execute at all.

Atomicity is a fundamental property of blockchain transactions that guarantees a transaction is processed as a single, indivisible unit. Either all operations within the transaction are executed successfully, or none of them are.

Why Atomicity Matters

In financial systems, partial execution of transactions would be catastrophic. If you swap Token A for Token B, atomicity ensures you can't lose Token A without receiving Token B. The transaction either completes both sides or reverts entirely.

Atomicity in Smart Contracts

Smart contracts on platforms like Ethereum enforce atomicity — if any step in a multi-step transaction fails, the entire transaction reverts and all state changes are undone. This is crucial for DeFi protocols where transactions often involve multiple token transfers and contract interactions in a single call.

Practical Example

When using a DEX to swap ETH for USDC, atomicity guarantees that the ETH leaves your wallet and USDC arrives in the same transaction. If the swap fails for any reason (insufficient liquidity, slippage too high), you keep your original ETH.

Frequently Asked Questions

What does atomicity mean in blockchain?

Atomicity means a transaction either executes completely with all its operations or not at all. There is no partial execution — if any step fails, the entire transaction is reverted to its original state.

Why is atomicity important in DeFi?

Atomicity prevents situations where you could lose one token without receiving another in a swap. It ensures complex multi-step DeFi transactions (like flash loans) are all-or-nothing, protecting users from partial execution losses.

Related Terms