1 of 29

HAWK:

Privacy-Preserving Smart Contracts

Ahmed Kosba, Andrew Miller, Elaine Shi, Zikai Wen, Charalampos Papamanthou

2 of 29

Bitcoin: Market Cap ($6.5B)

3 of 29

Financial Institution Investments

in “Blockchain”

4 of 29

Linq:

Private equity trading “on the blockchain”

5 of 29

The Blockchain Model of Computation

Contracts

Peer-to-Peer Blockchain Consensus Protocol

Code

Storage

Data

Users

Money

6 of 29

7 of 29

Bitcoin privacy guarantees are abysmal

Variety of transaction graph analysis techniques

We know how to fix this:

- Interactive mixing (Mixcoin, Coinjoin)

- Noninteractive mixing (Monero)

- Zerocash

8 of 29

Naive smart contracts LEAK EVERYTHING

- Code of the contract is public

- Data sent to the contract is public

- Money sent/received is public

- Adversaries can “front run”

- “Weakly pseudonymous” by default

Unsuitable for many real-world applications

9 of 29

Our solution: Hawk

Protocol suite and compiler for privacy preserving smart contracts

E.g. Auctions, Crowdfunding, Games, Financial instruments

Application developers do not have to know crypto details

10 of 29

Hawk

Serpent

11 of 29

Bitcoin

Zerocash

Ethereum

Programmability

Privacy

Hawk

12 of 29

Input

bids

1

Output

2

Blockchain Contract

Winner pays 2nd price

Other bidders get refund

Seller receives 2nd price

refunds

2nd price

leaked

Naive Blockchain

Auction

13 of 29

Main Idea: Zero-knowledge proofs

Contracts use underlying cash system (Zerocash)

Only encryptions of data are published

ZK proofs attest to validity of the data

A designated party (the manager) collects inputs from parties and produces a ZK proof

The blockchain acts as verifier of the ZK proofs

14 of 29

Freeze

comm( )

1

Compute

Encryption( ) , ZKP

2

Finalize

3

Encryption( ), ZKP

Verification Key

Blockchain Contract

Hawk Auction

Abort handler

15 of 29

Minimally trusted

manager (i.e., auctioneer)

  • Not for correctness
  • Not for input independence
  • Not for the security of the currency
  • Trusted only for posterior privacy in this contract

Can be implemented with SGX or MPC

16 of 29

Sealed-bid auction�

17 of 29

Sealed-bid auction�

Rock-paper-scissors

18 of 29

Sealed-bid auction�

Rock-paper-scissors

Kick-starter

19 of 29

Sealed-bid auction�

Rock-paper-scissors

Kick-starter

Financial Swap

20 of 29

Our compiler architecture

Pinocchio

jSNARK

libsnark

21 of 29

Performance

100-user auction or crowd-funding

Auctioneer: 2.8 min

User: 50 secs (independent of # users)

On-chain cost: ~1.5 second

Main overhead: SNARK proofs

22 of 29

Contract

User Protocol

Ideal Program

Ideal World

F( )

Wrapper

Pi( )

Wrapper

G( )

Wrapper

Real World

Simulation-based security in Smart Contract Model

23 of 29

More details in our tech report: http://oblivm.com/hawk/

How to use SNARKs in UC: https://eprint.iacr.org/2015/1093

New SNARK-smithing tools: https://github.com/akosba/jsnark

Ongoing efforts:

- Integration with Ethereum, other blockchain prototypes

- Implement alternatives with trusted hardware, MPC

- More protocols (e.g., multiple rounds)

Hawk provides privacy preserving contracts for blockchain application developers

24 of 29

25 of 29

Auction Manager

Create Contract

Send(Comm(P,v,nonce))

Pay(deposit)

Participant

Send([value,nonce])

Pay(value - deposit)

Receive deposits back

except if a winner / cheater

Receive(deposit +

winners/cheaters deposit)

Auction Contract

Store Commitments

Verify Commitments

Identify Winners /

Cheaters

26 of 29

Zero-knowledge proofs (zkSNARK)

ZkPoK{ (w) : P(stmt, w) }

Arbitrary function

Hidden Witness

Prover(statement, witness) → proof

Verifier(statement, proof) → {0,1}

27 of 29

A Toy version of “Zerocash” in Ethereum

data merkleTree, serialNumbers[]

def deposit(com):

assert msg.value == 1

merkleTree.treeInsert( com )

This is a commitment to:

( serialNumber, publicKey )

28 of 29

data merkleTree, serialNumbers[]

...

def withdraw(proof, serialNumber, destination):

assert verify(proof)

for ZkPoK{ ( publicKey, merkleProof, com, sig ) :

- com is included in merkleTree (using merkleProof)

- com is a commitment to (serialNumber, publicKey)

- sig is a signature on destination for publicKey

}

assert serialNumber is not yet in serialNumbers[]

add serialNumber to serialNumbers[]

send(destination, 1)

29 of 29

Smart Contract Model (e.g., Ethereum)

Contracts

Mined Block

Miners, public watchdogs

Block

# i

Block

# i + 1

Block

# i + 2

Time

Blockchain

……

Code

Storage

Data

Users

Money

All data and money

transactions are public