1 of 30

TITLE SLIDE

Placeholder

2 of 30

AGENDA SLIDE

Placeholder

9:30 -10:30 AM - Catered breakfast & mingling

10:30 AM - 12:00 - Part I: SNARK Landscape & Overview; Izaak Meckler, Co-founder & CTO, O(1) Lab

12:00 - 1:00 PM - Catered Lunch

1:00 -3:30 PM - Part II: Programming SNARKs; Izaak Meckler, Co-founder & CTO, O(1) Labs

3:30 - 3:45 PM - Bobbin Threadbare, ‘AirScript - Defining AIR Constraints for zk-STARKs’

3:45 - 4:00 PM - Brian Gu & Brice Huang, ‘Dark Forest - Using zk-SNARKs to build a strategy MMO on Ethereum’

4:00 - 4:30 PM - Closing Remarks, Vitalik Buterin, Founder & Chief Scientist, Ethereum Foundation

4:30-5:30 PM - Meet & Greet + Happy Hour

Agenda

3 of 30

4 of 30

What we’ll cover

What SNARKs are useful for

How to use them in the context of a full application architecture

How to use snarky to program SNARKs

5 of 30

Snapps: SNARKified apps

A SNAPP gives its users strong, verifiable guarantees about its behavior while preserving user privacy to the greatest extent possible.

6 of 30

An application: workplace democracy

Workers join an org based on endorsements from other org members

Workers can vote on relevant issues without revealing how they individually are voting.

How to implement this?

Goal: By the end of today, you’ll know enough to make this application.

7 of 30

An application: workplace democracy

We’ll implement a simplified version where the set of voters is fixed.

8 of 30

Voting architecture

Two phases

  1. Registration: Users register their information with a registrar
  2. Voting: Users vote on whatever elections they like

Security desiderata

  1. Registered users can vote exactly once. Users who have not registered cannot vote.
  2. Privacy of votes.

9 of 30

Voting architecture

Registrar

Voter

Register voter record

Submit votes

Broadcast votes from all

10 of 30

11 of 30

Registering a voter record

Name

Izaak Meckler

Favorite color

Blue

Private key

Nori’snta;9 k*THARSXn

12 of 30

Registration closes

Name

Izaak Meckler

Favorite color

Blue

Private key

Nori’snta;9 k*THARSXn

13 of 30

Voting

Name

Izaak Meckler

Favorite color

Blue

Private key

Nori’snta;9 k*THARSXn

Registrar checks:

  • Does this key belong to a registered voter?
  • Has this key voted in this election yet?

14 of 30

Problems

Registrar can see how individuals are voting

Keys broadcast on network, so others can impersonate

Name

Izaak Meckler

Favorite color

Blue

Private key

Nori’snta;9 k*THARSXn

Registrar checks:

  • Does this key belong to a registered voter?
  • Has this key voted in this election yet?

15 of 30

Registering a voter record

Instead of record, send its hash

Name

Izaak Meckler

Favorite color

Blue

Private key

Nori’snta;9 k*THARSXn

16 of 30

Voting

Name

Izaak Meckler

Favorite color

Blue

Private key

Nori’snta;9 k*THARSXn

Instead of sending private key with election, send hash

17 of 30

Voting

Name

Izaak Meckler

Favorite color

Blue

Private key

Nori’snta;9 k*THARSXn

Registrar needs to check

  • Does this key belong to a registered voter?
  • Has this key voted in this election yet?

18 of 30

Voting

Name

Izaak Meckler

Favorite color

Blue

Private key

Nori’snta;9 k*THARSXn

SNARKs let us selectively reveal information

“This is a hash of some data”

SNARK

SNARK

19 of 30

Voting

Name

Izaak Meckler

Favorite color

Blue

Private key

Nori’snta;9 k*THARSXn

This solves the problem of “no double voting”

Remaining problem: How do we know the hidden private key belongs to a registered user?

SNARK

20 of 30

Voting

Name

Izaak Meckler

Favorite color

Blue

Private key

Nori’snta;9 k*THARSXn

Problem: How do we know that hidden private key belongs to a registered user?

SNARK

21 of 30

Voting

Name

Izaak Meckler

Favorite color

Blue

Private key

Nori’snta;9 k*THARSXn

Solution: Merkle trees!

SNARK

22 of 30

Proving knowledge of a preimage

23 of 30

Proving knowledge of a preimage

24 of 30

Proving knowledge of a preimage

SNARK

25 of 30

Crash course: Fields

A “field” is a type supporting

  • Addition +
  • Subtraction -
  • Multiplication *
  • Division /

We can make a field out of the numbers 0, 1, …, p - 1 if p is prime (e.g., 17)

In our setting p is a large prime, think ~2256 or even larger.

26 of 30

Crash course: Fields

Inside the SNARK, the only efficient thing is field operations

Relevant for us: hashes operate on field elements

27 of 30

Crash course: Merkle trees

-> whiteboard

28 of 30

Install docker

  • docker load < snarky.tar.gz
  • docker run --name sfbw -it $HASH_OUTPUT_FROM_LOAD
  • On linux: sudo usermod -aG docker $USER

Install vscode

  • Install: Remote-Containers extension
  • Install vscode-reasonml extension

29 of 30

Links

codaprotocol.com/docs/snarks/snarky/

reasonml.github.io/docs/en/syntax-cheatsheet

30 of 30

Complex authentication

Goal: Decentralized Facebook

Each users hosts their own profile

They shouldn’t be able to know who is looking at their profile, just that the person is allowed to look at their profile.