Deterministic, atomic operations - all or nothing
- In computer science, an event is said to be "atomic" if it cannot be split into smaller parts. For example, the statement
x = yis atomic if the language guarantees that
ycannot be partially copied to
- In the world of databases, atomicity is often specified by the developer by grouping multiple operations in a wrapper such as a commit or rollback block, to ensure that all of the steps are complete or none of the steps execute at all. This method is often used to ensure database integrity.
- In the context of a blockchain, a transaction is a single instruction allowed by the protocol, signed as required by the protocol, and sent to the blockchain through a local node connected to the network. Transactions are either completely successful or they fail. Generally, the actual result cannot be known with certainty until the transaction is included in a block to establish an execution order. For example, a transaction to send funds from Alice to Bob depends on Alice's balance at execution time.
- All nodes must arrive at the same conclusion; given a transaction in a certain sequence, all nodes must agree on the result. This means the protocols must be deterministic. Either the transaction was successful or it failed, and the effect must be indisputable.
- Therefore, blockchain transactions are both deterministic and atomic.