Demystifying Blockchains: Decentralized, Secure and Fault-tolerant - - PowerPoint PPT Presentation

demystifying blockchains decentralized secure and fault
SMART_READER_LITE
LIVE PREVIEW

Demystifying Blockchains: Decentralized, Secure and Fault-tolerant - - PowerPoint PPT Presentation

Demystifying Blockchains: Decentralized, Secure and Fault-tolerant Storage Amr El Abbadi University of California, Santa Barbara In Collaboration with: Mohammad Amiri, Sujaya Maiyya, Victor Zakhary, and Divyakant Agrawal. Brown 2019 1


slide-1
SLIDE 1

In Collaboration with: Mohammad Amiri, Sujaya Maiyya, Victor Zakhary, and

Divyakant Agrawal.

Amr El Abbadi University of California, Santa Barbara

Demystifying Blockchains: Decentralized, Secure and Fault-tolerant Storage

Brown 2019 1

slide-2
SLIDE 2

Blockchains

  • Many interesting (controversial?) problems in

new guises.

  • Distributed Systems: Consensus, replication, etc
  • Data Management: Transactions, replication,

commitment, etc

  • Security: Encryption, hashing, etc
  • Economics: Money, tokens, assests, etc

Brown 2019 2

slide-3
SLIDE 3

Bitcoin

Brown 2019 3

slide-4
SLIDE 4

Traditional Banking Systems

  • From Database and Distributed Computing Perspective
  • Identities and Signatures
  • You are your signature: IDENTITY

 Private and Public Digital signatures

  • Ledger
  • The balance of each identity (saved in a DB)

 Blockchain (basically a linked list!)

  • Transactions
  • Move money from one identity to another
  • Concurrency control to serialize transactions  Mining and Proof of Work
  • Typically backed by a transactions log
  • Log is persistent (disk)  Replication to the whole world
  • Log is immutable and tamper-free (end-users trust this)  HashPointers

Brown 2019 4

slide-5
SLIDE 5

Blockchain Architecture

Storage Layer Application Layer

Brown 2019 5

  • The ledger is fully replicated to all network nodes
  • A Block is a set of transactions submitted by the clients.
slide-6
SLIDE 6

Transaction Model

TX1

0.1 BTC 0.5 BTC 1.2 BTC 1.8 BTC 1.8 BTC

TX2

0.3 BTC 1.5 BTC

Merge Assets Split Assets

Assuming no imposed transaction fees!

Brown 2019 6

slide-7
SLIDE 7

Transaction Model

0.5 BTC Sign TX1 0.1 BTC 0.1 BTC 1.8 BTC 1.5 BTC 0.3 BTC TX2 Sign

Brown 2019 7

slide-8
SLIDE 8

The Ledger: Some Technical Details

  • How is the ledger tamper-free?

Blocks are connected through hash-pointers

  • Each block contains the hash of the previous block header
  • Tampering with the content of any block can easily be detected

Hash() Hash() Hash()

Brown 2019 8

slide-9
SLIDE 9

Making Progress

  • To make progress:
  • Network nodes validate new transactions to make sure that:
  • Transactions on the new block do not conflict with each other
  • Transactions on the new block do not conflict with previous blocks transactions
  • Network nodes need to agree on the next block to be added to the blockchain
  • New assets are generated and registered through mining.
  • Reward transaction in every mined block

Consensus

Brown 2019 9

Hash() Hash() Hash()

slide-10
SLIDE 10

Consensus Protocols

All participants should be known a priori

  • Permissioned vs Permissionless settings
  • Permissionless Blockchains:
  • Network nodes freely join or leave at anytime
  • Nakamoto’s Consensus: Proof of Work (PoW)
  • Ethereum’s Consensus: Proof of Stake (PoS)
  • :Permissioned Blockchains
  • Paxos (Crash failures only)
  • Byzantine Fault-tolerance (malicious failures)

Brown 2019 10

slide-11
SLIDE 11

Mining Details: Block Creation

TX1 TX2 TXn .

. .

TX1 TX2 TXn .

. .

TX1 TX2 TXn .

. . CS171 11

slide-12
SLIDE 12

Mining Details: Block Contents

TX1 TX2 TXn .

. .

TX1 TX2 TXn .

. .

TX1 TX2 TXn .

. .

TXreward TX1 TX2 TXn .

.

TXreward Transactions Header Version Previous Block Header Hash Merkle Tree Root Hash Time Stamp Current Target Bits Nonce

SHA256( ) < D

CS171 12

slide-13
SLIDE 13

Mining Details

TX1 TX2 TXn .

. .

TX1 TX2 TXn .

. .

TX1 TX2 TXn .

. .

TX1 TX2 TXn .

.

TXreward Transactions Header Version Previous Block Header Hash Merkle Tree Root Hash Time Stamp Current Target Bits Nonce

SHA256( ) < D

  • D: dynamically adjusted difficulty
  • Difficulty is adjusted every 2016 blocks (almost 2 weeks)

256 bits Difficulty bits

CS171 13

slide-14
SLIDE 14

Forks

  • Transactions in the forked blocks might have conflicts
  • Could lead to double spending
  • Forks have to be eliminated
  • Transactions in this block have to be resubmitted
  • Miners join the longest chain to resolve forks
slide-15
SLIDE 15

Some Limitations of Bitcoin

  • High transaction-confirmation latency
  • Probabilistic consistency guarantees
  • Very low TPS ( Transactions per second) - average of 3 to 7 TPS
  • Transparency leads to lack of privacy
  • Energy consumption due to PoW.
slide-16
SLIDE 16

Atomic Commitment Across Blockchains

Brown 2019 16

slide-17
SLIDE 17

The Landscape

Source: coinmarketcap.com on June 7th 2019 at 5:00pm PST

Brown 2019 17

slide-18
SLIDE 18

The Landscape

  • Thousands of Blockchains
  • Tens of thousands of markets
  • Exchanges to trade tokens for USD
  • Direct token transactions in one blockchain
  • Direct token transactions across blockchains, how?
  • Cross-chain transactions

Brown 2019 18

slide-19
SLIDE 19

Cross-ChainTransaction Example

X bitcoins Y ethers

X Y

Atomic Cross-Chain Commitment Protocol

X Y

19 Brown 2019

Swap of Ownership

slide-20
SLIDE 20

Atomic Swap Example [Nolan’13, Herlihy’18]

  • Alice wants to trade Bitcoin for Ethereum with Bob

Bob Alice

Brown 2019 20

slide-21
SLIDE 21

Atomic Swap Example [Nolan’13, Herlihy’18]

  • Alice wants to trade Bitcoin for Ethereum with Bob

Bob Alice

  • Create a secret s
  • Calculate its hash h = H(s)

s and h

Brown 2019 21

slide-22
SLIDE 22

Atomic Swap Example [Nolan’13, Herlihy’18]

  • Alice wants to trade X Bitcoin for Y Ethereum with Bob

Bob Alice s and h T1 Move X bitcoins to Bob if Bob provides secret s | h = H(s) Bitcoin blockchain T1

Brown 2019 22

slide-23
SLIDE 23

Atomic Swap Example [Nolan’13, Herlihy’18]

  • Now, h is announced in Bitcoin blockchain and made public

Bob Alice s Alice’s X bitcoins are locked in T1’s smart contract Bitcoin blockchain T1 Ethereum blockchain T2 Move Y Ethereum to Alice if Alice provides secret s | h = H(s) T2

Brown 2019 23

slide-24
SLIDE 24

Atomic Swap Example [Nolan’13, Herlihy’18]

  • Now, for Alice to execute T2 and redeem Y Ethereum, she reveals s

Bob Alice s Alice’s X bitcoins are locked in T1’s smart contract Bitcoin blockchain T1 Ethereum blockchain Bob’s Y Ethereum are locked in T2’s smart contract T2

Brown 2019 24

slide-25
SLIDE 25

Atomic Swap Example [Nolan’13, Herlihy’18]

  • Revealing s, executes T2. Now s is public in Ethereum’s blockchain

Bob Alice s Alice’s X bitcoins are locked in T1’s smart contract Bitcoin blockchain T1 Ethereum blockchain Bob’s Y Ethereum are locked in T2’s smart contract T2

Brown 2019 25

slide-26
SLIDE 26

Atomic Swap Example [Nolan’13, Herlihy’18]

  • Now, Bob uses s to execute T1 and redeem his Bitcoins

Bob Alice s Alice’s X bitcoins are locked in T1’s smart contract Bitcoin blockchain T1 Ethereum blockchain Bob’s Y Ethereum are locked in T2’s smart contract T2 s

Brown 2019 26

slide-27
SLIDE 27

Atomic Swap Example: What can go wrong?

  • Alice locks her X Bitcoins in Bitcoin’s blockchain through T1
  • Bob sees T1 but refuses to insert T2
  • Now, Alice’s Bitcoins are locked for good
  • A conforming party (Alice) ends up worse off because Bob doesn’t follow the

protocol

  • Prevention
  • Use timelocks to expire a contract
  • Specify that an expired contract is refunded to the creator of this contract

Brown 2019 27

slide-28
SLIDE 28

Atomic Swap Example: Timelocks

Bob Alice T1: Move X bitcoins to Bob if Bob provides secret s | h = H(s) T2: Move Y Ethereum to Alice if Alice provides secret s | h = H(s) T3: Refund T1 to Alice if Bob does not execute T1 before 48 hours T4: Refund T2 to Bob if Alice does not execute T2 before 24 hours How to determine the time period of a timelock?

Brown 2019 28

slide-29
SLIDE 29

Atomic Swap Example [Nolan’13, Herlihy’18]

Δ Δ Δ Δ

Alice-Bob in Bitcoin

e.g., Δ = 12hr

X bitcoins Y ethers

Bob-Alice in Ethereum

Alice reveals the secret to Bob’s contract and claims the Y ether Now, Bob takes the secret, reveals it to Alice’s contract and claims the X bitcoins

Brown 2019 29

slide-30
SLIDE 30

What can go wrong?

Δ Δ Δ Δ

Alice-Bob in Bitcoin

X bitcoins Y ethers

Bob-Alice in Ethereum

If Bob fails or suffers a network denial of service attack for Δ, Alice’s contract will expire and Bob will lose his X bitcoins

Atomicity Violation

X bitcoins are refunded to Alice any time after the contract expires

Brown 2019 30

slide-31
SLIDE 31

Atomicity Violation

  • Using timelocks leads to Atomicity violation
  • Our Atomicity-based Approach:
  • The decision of both transactions should be made atomic
  • Once the decision is taken, both transactions either commit or abort
  • A transaction cannot commit unless a commit decision is reached
  • A transaction cannot abort unless an abort decision is reached

Brown 2019 31

slide-32
SLIDE 32

Building block: Cross-Chain Verification

  • How can miners of one blockchain:
  • Verify a transaction in another blockchain?
  • Without maintaining a copy of this other blockchain.

Brown 2019 32

slide-33
SLIDE 33

Building block: Cross-Chain Verification

TX1

Current head

Transaction TX1

  • f interest

Verified Blockchain

d blocks d blocks

SC { S1 } Current head

Verifier Blockchain

SC { S2 }

TX1 TX1 evidence 1 2 3 4 5 6

Brown 2019 33

Need to verify that TX1 is actually in verified blockchain TX1 Evidence

slide-34
SLIDE 34

Building block: Cross-Chain Verification

  • Verification process:
  • Each header includes the hash of the previous header
  • The proof of work of each header is correct
  • TX1 is correct
  • TX1 is buried under d blocks
  • The cost of generating evidence:
  • Choose d to make this cost > the value transacted in TX1
  • If true, a malicious user has no incentive to create a fake evidence

TX1 TX1 evidence d blocks

Brown 2019 34

slide-35
SLIDE 35

Atomic Commitment Across Blockchains

  • Use another blockchain to witness the Atomic Swap
  • The witness blockchain decides the commit or the abort of a swap
  • Once a decision is made:
  • All sub-transactions in the swap must follow the decision
  • Achieves atomicity, either all committed or all aborted
  • Cross chain verification is leveraged twice
  • Miners of the witness network verify the publishing of contracts in asset

blockchains

  • Miners of assets’ blockchains verify the decision made in the witness network
slide-36
SLIDE 36

Protocol Sketch

  • Deploy a contract SCw in the witness network with state Published (P)
  • SCw has a header of a block at depth d of all blockchains in the swap

SCw { S=P}

Witness Blockchain d blocks Bitcoin Blockchain

Current head

Ethereum Blockchain

Brown 2019 36

Verifier Verified Verified

slide-37
SLIDE 37

Protocol Sketch Cont’d

  • Participants deploy their contracts in the corresponding blockchains
  • Participants add the header of SCw to their contracts

SCw { S=P}

Witness Blockchain d blocks Bitcoin Blockchain Ethereum Blockchain

SC1 { S=P} SC2 { S=P}

Brown 2019 37

Verifier Verified Verified

slide-38
SLIDE 38

Protocol Sketch Cont’d

  • Participants submit evidence of publishing the smart contracts in Assets

Blockchains

  • If all contracts are published and correct, SCw’s state is altered to redeem (RD)

SCw { S=P}

Witness Blockchain d blocks Bitcoin Blockchain Ethereum Blockchain

SC1 { S=P} SC2 { S=P} SCw { S=RD}

Brown 2019 38

Verifier Verified Verified

The Evidence

slide-39
SLIDE 39

Protocol Sketch Cont’d

  • Participants submit evidence of Redeem State (RD) from the Witness

Blockchain to the Assets Blockchains.

  • After evidence verification, participants redeem their assets from the

Assets Blockchains.

SCw { S=P}

Witness Blockchain d blocks Bitcoin Blockchain Ethereum Blockchain

SC1 { S=P} SC2 { S=P} SCw { S=RD} SC1 { S=RD} SC2 { S=RD}

Brown 2019 39

Verifier Verifier Verified

slide-40
SLIDE 40

Atomic Commitment Across Blockchains

  • SCw’s state determines the commit (RD) or the abort (RF) decision
  • Once SCw’s state is altered and the block is buried under d blocks:
  • All sub-transactions must follow this decision
  • None of the sub-transactions can decide on a different decision
  • Even if a participant fails or faces a network denial of service:
  • When the participant recovers, the evidence of the decision still exists
  • This evidence can be used to redeem or refund the contracts
  • The only way to violate atomicity is to fork the witness blockchain
  • Economic incentives prevent this attack
  • Any protocol is prone to fork attacks
slide-41
SLIDE 41

Parting Thoughts

  • Building global-scale blockchains is a collective effort.

Security, Privacy and Crypto Data Management Distributed Systems

41/46 Tokenomics 2019

Economics