640 likes | 652 Views
This lecture explores the concepts of atomicity, consistency, isolation, and durability in distributed computing and blockchain systems. It delves into the challenges of achieving these properties in cross-chain transactions and smart contracts.
E N D
Atomicity in Blockchains CS1951 L Spring 2019 21 March 2019 Maurice Herlihy Brown University
timing Hello World! crashes omission Byzantine Now solve consensus Classical Adversary
meltdown Привет мир!! spectre re-entrancy zero-day Now hold a free and fair election Modern Adversary
This Lecture Rethink Distributed Computing
This Lecture Rethink Correctness Linearizability ??? Atomicity “ACID” properties
C Carol has wants
A Alice has wants
B Bob has wants
A B C
Classical Distributed Computing versus trusted central coordinator Crash failures, Lost messages …
A B C DB DB DB
A B C Lock your assets! DB DB DB
A B C Lock your assets! DB DB DB
A B C Prepare your transfers! DB DB DB
A B C Prepare your transfers! OK OK DB DB OK DB
A B C Commit! Done! Done! DB DB Done! DB
“ACID” Properties Atomicity Consistency Isolation Durability
“ACID” Properties Atomicity Consistency All or nothing: either Alice, Bob, Carol trade, or no one trades Isolation Durability
“ACID” Properties Atomicity Consistency Each transaction preserves invariants: no money created or destroyed, et cetera Isolation Durability
“ACID” Properties Atomicity Consistency Isolation No transaction sees another’s intermediate states: money once promised can’t be spent Durability
“ACID” Properties Atomicity Consistency Isolation Transaction effects survive system crashes Durability
Future Distributed Computing versus Blockchain & smart contracts Trust (almost) no one
Abstraction:Distributed Ledger Append-only list of events Not just financial Everyone agrees on content Tamper-proof!
Smart Contracts Not contracts, not smart … Turing-complete scripting language
Hashlock Secret s Hashlock H(s) Contract Escrows asset, Knows H(s), Transfers asset when s provided
Hashed Timelock Contract But if secret not provided within time k, refunds for everyone! time to publish & notice contract
A B C Cross-Chain Swap Protocol altcoin blockchain bitcoin blockchain car title blockchain
A B C Alice Has a Secret s H(s)
A B C Alice Publishes Contract with Bob contract altcoin blockchain Transfer altcoins to Bob hashlock Time: t
A B C Bob Publishes Contract with Carol contract Transfe bitcoins to Carol hashlock contract bitcoin blockchain Time: t
A B C Carol Publishes Contract with Alice contract Transfer Cadillac title hashlock contract car title blockchain contract Time: t
A B C Phase Two contract contract contract Time: t
A B C Alice Triggers Contract with Carol contract contract reveal contract Time: t
A B C Alice Triggers Contract with Carol contract contract reveal contract Time: t
A B C Alice Triggers Contract with Carol contract contract reveal contract Time: t
A B C Carol Triggers Contract with Bob contract contract contract Time: t
A B C Carol Triggers Contract with Bob contract contract reveal contract Time: t
A B C Carol Triggers Contract with Bob contract contract reveal contract Time: t
A B C Bob Triggers Contract with Alice contract reveal contract contract Time: t
A B C Bob Triggers Contract with Alice contract reveal contract contract Time: t
A B C Bob Triggers Contract with Alice contract contract everyone happy! contract Time: t
“ACID” Properties I laugh at your inadequate notions of correctness Atomicity Consistency Isolation Durability
“ACID” Properties Atomicity Consistency Isolation All or nothing property impossible to guarantee Durability
A B C Irrational Behavior Reveal s prematurely No Cadillac for you!
If all parties conform, all swaps take place Done! Done! Done! Done!
Even If some parties deviate, no conforming party is“worse off” I’m OK I’m OK I’m OK ??? Expressing correctness requires a little game theory
Even If some parties deviate, no conforming party is“worse off” Defining what this means is a research project!
New “ACID” Properties Atomicity Consistency Isolation If all conform, swaps happen, otherwise, conforming parties “no worse off” Durability
“ACID” Properties Atomicity Consistency Isolation What does this mean for cross-blockchain transactions? Durability
Strong Nash Equilibrium Everyone follows one strategy … But if a coalition deviates… It won’t improve its payoff