Atomic Delivery

Модель виконання «все або нічого», за якої транзакція завершується повністю або повністю скасовується.

Термін 'атомарний' походить від грецького слова 'atomos' (неподільний). Без атомарності фінансові системи були б нестабільними. Наприклад, переказ 100 доларів — це дві дії: списання і зарахування. Атомарність гарантує, що гроші не 'зникнуть', якщо система зависне між цими двома кроками.

        graph LR
  Center["Atomic Delivery"]:::main
  Pre_distributed_systems["distributed-systems"]:::pre --> Center
  click Pre_distributed_systems "/terms/distributed-systems"
  Pre_networking["networking"]:::pre --> Center
  click Pre_networking "/terms/networking"
  Pre_consensus_mechanism["consensus-mechanism"]:::pre --> Center
  click Pre_consensus_mechanism "/terms/consensus-mechanism"
  Rel_atomic_swap["atomic-swap"]:::related -.-> Center
  click Rel_atomic_swap "/terms/atomic-swap"
  classDef main fill:#7c3aed,stroke:#8b5cf6,stroke-width:2px,color:white,font-weight:bold,rx:5,ry:5;
  classDef pre fill:#0f172a,stroke:#3b82f6,color:#94a3b8,rx:5,ry:5;
  classDef child fill:#0f172a,stroke:#10b981,color:#94a3b8,rx:5,ry:5;
  classDef related fill:#0f172a,stroke:#8b5cf6,stroke-dasharray: 5 5,color:#94a3b8,rx:5,ry:5;
  linkStyle default stroke:#4b5563,stroke-width:2px;

      

🧒 Простими словами

Це як купівля іграшки. Ви віддаєте гроші тільки тоді, коли отримуєте іграшку в руки. Якщо іграшки немає, гроші залишаються у вас. Обидві дії відбуваються одночасно, або не відбуваються взагалі.

🤓 Expert Deep Dive

У базах даних атомарність зазвичай реалізується через журнали випереджального запису (WAL). У блокчейні (наприклад, EVM) атомарність є нативною: якщо смарт-контракт викликає помилку revert(), усі зміни стану в цій транзакції скасовуються. Для різних блокчейнів (кросчейн) атомарна доставка реалізується через атомарні свопи з використанням Hashed Timelock Contracts (HTLC).

❓ Часті питання

What does the 'A' in ACID stand for?

The 'A' in the ACID database model stands for Atomicity, which is the exact same concept as atomic delivery: transactions are indivisible and all-or-nothing.

What is an Atomic Swap in crypto?

An atomic swap allows two people to trade different cryptocurrencies (like Bitcoin for Ethereum) directly from their wallets without using a centralized exchange. It uses atomic delivery to ensure neither party can run away with the funds.

What happens if an atomic transaction fails halfway?

The system initiates a 'rollback'. It undoes any changes made during the partial execution, returning the system to the exact state it was in before the transaction started.

🔗 Пов'язані терміни

Попередні знання:

📚 Джерела