Skip to content

Commit

Permalink
first draft lambdaclass ETHCC slides, start on workshop copy
Browse files Browse the repository at this point in the history
  • Loading branch information
nuke-web3 committed Jul 5, 2024
1 parent cadadb3 commit 22bb7f5
Show file tree
Hide file tree
Showing 11 changed files with 389 additions and 4 deletions.
5 changes: 4 additions & 1 deletion content/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
---

- [RISC Zero](./risc-zero/index.md)
- [🗃️ Zypher Games Buildathon - June 2024](./risc-zero/zypher-buildathon/materials.md)
- [🗃️ Zypher Games Buildathon - Online - June 2024](./risc-zero/zypher-buildathon/materials.md)
- [🪧 Verifiable Games Using RISC Zero](./risc-zero/zypher-buildathon/presentation.md)
- [👷 ZK Chess Checkmate](./risc-zero/zypher-buildathon/workshop.md)
- [🗃️ LmabdaClass Hackathon - Brussels - June 2024](./risc-zero/lambdaclass-ethcc-brussels/materials.md)
- [🪧 No Circuits Required - Building ZK Proof Systems in Pure Rust](./risc-zero/lambdaclass-ethcc-brussels/presentation.md)
- [👷 ZK ERC20 Balance of EDCSA Verified Account](./risc-zero/lambdaclass-ethcc-brussels/workshop.md)

- [🙋 Contribute](./contribute/index.md)
- [🌀 Topic Template](./contribute/template/page.md)
Expand Down
55 changes: 55 additions & 0 deletions content/risc-zero/lambdaclass-ethcc-brussels/img/r0_link_ethcc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions content/risc-zero/lambdaclass-ethcc-brussels/materials.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# LambdaClass Hackathon - ETHCC Brussels

## 📝 Hackathon Specific Info

- <a target="_blank" href="https://dorahacks.io/hackathon/lambdahackweek2/">DoraHacks Event Page <strong>(APPLY HERE)</strong></a>
- <a target="_blank" href="https://dorahacks.io/hackathon/lambdahackweek2/bounties#risc-zero">RISC Zero Bounty Info</a>
- <a target="_blank" href="https://lambdaclass.com/">LambdaClass Homepage</a>
- RISC Zero [🪧 Presentation (Video & Sides)](./presentation.md)
- RISC Zero [👷 Workshop (Signing and STEELing)](./workshop.md)

## 🤩 More @ ETHCC from RISC Zero

### 👉 https://r0.link/ethcc 👈

This cheatsheet tells you:

- The who, what, when, where, for events at ETHCC 2024 🇧🇪
- Links to join our socials
- Perhaps a little alpha 😉
14 changes: 14 additions & 0 deletions content/risc-zero/lambdaclass-ethcc-brussels/presentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# No Circuits Required - Building ZK Proof Systems in Pure Rust

<!-- markdown-link-check-disable -->
<center>
<iframe style="width: 90%; aspect-ratio: 1400/900; margin: 0 0;" src="slides.html"></iframe>
<br />
<a target="_blank" href="../../contribute/how-to/page.md#-how-to-use-revealjs-slides"><i class="fa fa-pencil-square"></i> How to use the slides</a> -
<a target="_blank" href="slides.html"><i class="fa fa-share-square"></i> Full screen (new tab)</a>
</center>
<!-- markdown-link-check-enable -->

<center style="margin: 1.3em 0; font-size: 1.2em;"><i class="fa fa-chevron-circle-down"></i> <strong>Slides Content</strong><i class="fa fa-chevron-circle-down"></i></center>
{{#include slides.md}}
<a href="#top" style="position: fixed; right: 11%; bottom: 3%;"><i style="font-size: 1.3em;" class="fa fa-arrow-up"></i></a>
257 changes: 257 additions & 0 deletions content/risc-zero/lambdaclass-ethcc-brussels/slides.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
---
title: No Circuits Required - Building ZK Proof Systems in Pure Rust
tags: RISC Zero, Talk, Presentation, Workshop, zkVM, Steel, EVM, LambdaClass, Hackathon, Zero Knowledge Proof, Applied Cryptography, Rust, ETHCC, Brussels
duration: 60 minuets
description: RISC Zero Workshop for the Zypher Provable Games Buildathon - June 2024
date: 2024-06-01
#
# RevealJS Settings
#
# Add custom css files for your slides here, comma separated:
separator: "\r?\n---\r?\n"
verticalSeparator: "\r?\n---v\r?\n"
# Below can be any of these: https://revealjs.com/config/
revealOptions:
transition: "convex" # animation between slides = none/fade/slide/convex/concave/zoom
backgroundTransition: "none" # background swap between slides = none/fade/slide/convex/concave/zoom
slideNumber: true
controls: true
progress: true
---

<link rel="stylesheet" href="/tools/styles/r0-theme.css">

<section data-background-opacity=0.3>

# No Circuits Required

## Building ZK Proof Systems in _Pure Rust_

<a target="_blank" href="https://nuke-web3.github.io/book/risc-zero/lambdaclass-ethcc-brussels/materials.html">Event Materials ↗️</a>

---

## Why RISC Zero?

### _Write Rust 🦀<br/> Not Circuits 𝛌_

Notes:

### Story time!

Started in self-sovereign tech rabbit whole 2018 ETHDenver.
Mesh networks, local first, DAOs and co-ops, token engineering...
Then I found out about ZKPs and what they can do to fundamentally change the game and enable things that were impossible before.
As an fanboi of the ZK Podcast for years, I wanted so much to get in... but there was a problem: learning curve on cryptography.
I want to build cryptographic systems, but not need to deeply understand the moon math...
Enter zkVMs: RISC Zero.
Now we can all make ZKPs with only a strong conceptual grasp of constraint systems and Rust (more languages to come!)

---

## Why RISC Zero?

- **Verifiable Computation**: outsource-able
- **Highly Scalable**: low-cost verification
- **Tunable Privacy**: robust & universal\*

Notes:

- you can verify that a computation of a specific program ran exactly as it should, even if done by untrusted executor!
- _Prover_ that runs program & produces _receipt_ reveals as little as nothing to everything about execution to _verifier_.
- Verification is significantly cheaper than running computation yourself... at the cost of prover doing significantly more work to run the _zkVM_
- \* Privacy is from everyone outside the prover, if you are the prover, no one but you has secret data.

---

## What key web3 problems can ZK address?

<nuke-cols>
<nuke-col center>

### EVM Devs

- **Referring to historical state**
- **Trusting off-chain logic**
- Calldata limits restrict logic
- Prohibitive gas costs
- Most blockchains lack privacy

</nuke-col>
<nuke-col center>

### Layer <0|1|2|...> Devs

- **True ZK (Privacy)**
- **Scalability (Compression)**
- **Interoperability (🌉, rollups)**
- Proof composition (Recursion)
- Proof continuation (Boundless)

</nuke-col>
</nuke-cols>

> See RISC Zero <a target="_blank" href="https://dev.risczero.com/api/use-cases">docs</a> and <a target="_blank" href="https://risczero.com/blog">blog</a> for **lots** more
Notes:

- **ZK coprocessor** - run verifiable program logic in zkVM by 3rd party or yourself to untrusting parties
- Added **security** and **fairness** and **privacy** that zero knowledge proofs can provide, as they involve complex decision-making and competitive interactions.
- Privacy is optional, fully transparent games with ZKPs _can_ provided added guarantees around many things other than that (if carefully designed)

---

## RISC Zero Bounties

- 🤩 Best zkVM Application - _1,500 USD Up to 3x 500 USD_
- 🤝 ZK Coprocessor - _1,000 USD Up to 2x 500 USD_
- 👪 Integrations - _1,000 USD Up to 2x 500 USD_

> **Qualifications on [DoraHacks](https://dorahacks.io/hackathon/lambdahackweek2/bounties#risc-zero) 👀**
Notes:

---

## RISC Zero 101

<img rounded style="width: 60%;" src="./img/zkVM-diagram-black.png" />

> Read <a target="_blank" href="https://dev.risczero.com/api/getting-started">Getting Started</a> and/or watch the <a target="_blank" href="https://www.youtube.com/playlist?list=PLcPzhUaCxlCj7wKkzekYYq7QDvtGTOPm7">playlist</a>.
Notes:

- deeper understanding as exercise for views of this presentation.
- very happy to answer questions on our discord!

---

## RISC Zero On-chain

<img rounded style="width: 60%;" src="./img/risc0-ethereum-bonsai.png" />

> Read about <a target="_blank" href="https://dev.risczero.com/api/blockchain-integration/bonsai-on-eth">Blockchain Integration</a> and watch the <a target="_blank" href="https://www.youtube.com/playlist?list=PLcPzhUaCxlCgsTtFen4oxFIDkUMSVSFFo">Foundry Template playlist</a>.
---

# ✨ Inspiration

##### ⚠️ -- Do not copy 🍝 -- 🙏

Notes:

Plagiarism, missing attribution and violating licenses will disqualify you!
Building on them to something significantly enhancements _**may**_ be considered - please let us know what you are planning :grin:

---

## <a target="_blank" href="https://devfolio.co/projects/zksnake-c689">zkSnake (R0 v0.20)</a>

<iframe loading=lazy width="560" height="315" src="https://www.youtube-nocookie.com/embed/zkMqd_AhCFU" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>

#### <a target="_blank" href="https://github.com/0xAndoroid/zkSnake">zkSnake Source ↗️</a>

Notes:

- Winner of RISC Zero Coprocessor Bounty at ETHDenver 2024 and did well in community quadratic voting too!
- Idea: take it further and make a bevy app in wasm w/ webGPU with **shared core logic identical on web & "re-player" zkVM**

---

<img rounded style="width: 50%; height: 50%; object-fit: cover;" src="./img/steel-banner.png" />

Notes:

Want to build even more complicated or otherwise impossible contract logic?
Enter Steel - view call library.

---

# 👷 Signing and Steeling Workshop

<!-- FIXME link that works in book and slides and gh-pages -->

**Join in following the [Hands-on instructions ↗️](./workshop.md)**

---

## 🎇 What is special about RISC Zero? (1)

- Developer productivity (@ hackathons & beyond)
<br/>&nbsp; Top 1000 <a target="_blank" href="https://crates.io/">crates.io</a> tested nightly,
<br/>&nbsp; benchmarks and more: <a target="_blank" href="https://reports.risczero.com/">reports.risczero.com</a>
- Hard in zkDSL, easy in zkVM:
<br/>&nbsp; Loops & branching
<br/>&nbsp; Design 🡺 Implementation 🡺 Auditing

Notes:

- Lots of ZKP options, why use R0?
- zkDSL _could_ be more performant, but time to market is very high, small set of humans can implement them at all.
- Why use us over other zkVMs?
First, arguably best devex, v1.0 release stability and prover performance milestones!

---

## 🎇 What is special about RISC Zero? (2)

- Proof <a target="_blank" href="https://www.risczero.com/blog/continuations">continuation</a>
<br/>&nbsp; Unbounded guest programs
- Proof <a target="_blank" href="https://www.risczero.com/blog/proof-composition">composition</a>
<br/>&nbsp; "Proof-ception"
<br/>&nbsp; Hybrid Client side {🕵️privacy} & server {🦾power}
- Execution _separate_ from proof generation

Notes:

- Proof-ception = efficient verification of proofs within a guest.
- Privacy for small client side proofs and the bulk of proof computational overhead outsourced to an untrusted prover.
- Reuse of existing proofs included in new proof using their journal
- Batching/compression of many proofs
- Proof transposition for compatibility of specific verifiers.
- Execution is near zero overhead, proving is high overhead.
- Realtime exec & prove in parallel / after / remote is possible
- What killer features does R0 provide?

---

## 🎇 What is special about RISC Zero? (3)

### ⛓️ EVM Support

- <a target="_blank" href="https://github.com/risc0/risc0-foundry-template">RISC Zero Foundry template</a>
<br/>&nbsp; Write unbounded programs that are low cost to verify on any EVM chain
- <a target="_blank" href="https://github.com/risc0/risc0-ethereum">Ethereum contracts, proof systems, and more</a>
<br/>&nbsp; View call proofs with **Steel**
<br/>&nbsp; ZK Rollups & RollApps
<br/>&nbsp; ... Help us define more!

Notes:

- Zeth _could_ run existing solidity games off chain, optionally unbounded computation per block (gasless). [Zeth deep dive](https://www.youtube.com/watch?v=4pBmf839eOA)
- mention: 256 view call limit - could you do inclusion proof checkpoints? contract state is simply recursive proof of minimal thing needed (maybe block header / hash?) updated by anyone to use for deep archival view calls? prove "this state was in block X that is a child of recent block {younger than 256}"

---

## 🤿 Before you dive deep...

- You _must_ match versions of `cargo risczero` and your Cargo.toml deps
<br/>&nbsp; Some examples / templates may not be the version you need!
<br/>&nbsp; Bonsai (proving service) is 0.21, updating mid-July 2024 to 1.0
- Keep guest minimal - extra cycles are _**expensive**_
<br/>&nbsp; ...But this is a hackathon, don't stress too much!
- When experimenting, always use <a target="_blank" href="https://dev.risczero.com/api/generating-proofs/dev-mode"> `DEV_MODE`</a>!
<br/>&nbsp; Execution _only_ with mocked proving (fast!)
- Bonsai API key priority & support
<br/>&nbsp; Apply: <a target="_blank" href="https://www.bonsai.xyz/">bonsai.xyz/</a>
- 🧠 You are designing a cryptographic system, not just a game!
- Discord `#💻|support-forum` channel for help
<br/>&nbsp; Join: <a target="_blank" href="https://discord.com/invite/risczero">discord.gg/risczero</a>

---

# Further Reading & Resources

<img rounded style="width: 600px; height: 600px; object-fit: cover;" src="./img/r0_link_ethcc.svg" />

## [r0.link/ethcc](https://r0.link/ethcc)
33 changes: 33 additions & 0 deletions content/risc-zero/lambdaclass-ethcc-brussels/workshop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## ZK ERC20 Balance of ECDSA Verified Account (R0 v1.0)

### _Signing and Steeling_

Let's experiment with the powers provided by the [Steel library](https://github.com/risc0/risc0-ethereum/tree/main/steel) by taking the ERC20 example and extending it.
The base example only proves that some address holds a balance, with the essential proof being "Some address holds over 1 token at some ERC20 contract at the most recent block"
That isn't a particularly useful statement... let's constrain the proof a bit more to assert that the prover also holds the key to the account in question.

> NOTE: The address and contract are optionally hidden to the verifier, so we can know the prover has a balance, but not DOX them!
1. Watch <a target="_blank" href="https://www.youtube.com/playlist?list=PLcPzhUaCxlCj7wKkzekYYq7QDvtGTOPm7">this playlist</a> to learn the basics of RISC Zero.
1. Use `rzup` to setup your development environment based on the **correct version of the <a target="_blank" href="https://dev.risczero.com/api/">RISC Zero Getting Started Docs</a>** for you.
```sh
# Get rzup
curl -L https://risczero.com/install | bash
# Follow command instructions to use rzup
# ... This will take a while first time!
```
1. TODO workshop repo will be up soon™️

## 📝 Key Takeaways

- Use crates in the zkVM without modification - no need to rewrite in circuits or zkDSL!
- Use standard patterns like `println!` & `fmt!` normally for basic experiments and debugging in `DEV_MODE`.
- 10s on lines of code overall -> useful proof, easily extensible!
- There is still many risks of creating privacy and security faults via bugs and all the normal ways cryptographic systems can break down...
_**With zkVMs you are abstracting the math/circuits of zk... NOT the robust design and audits required to harden your system!**_

## 🤓 Taking it Further

Here are some ideas to keep extending this example to learn more:

- Soon™️
2 changes: 1 addition & 1 deletion content/risc-zero/zypher-buildathon/materials.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 📝 Event Specific Info

- <a target="_blank" href="https://dorahacks.io/hackathon/zypher-hackathon/hackers">Dora Hacks Event Page <strong>(APPLY HERE)</strong></a>
- <a target="_blank" href="https://dorahacks.io/hackathon/zypher-hackathon/hackers">DoraHacks Event Page <strong>(APPLY HERE)</strong></a>
- <a target="_blank" href="https://zyphergames.notion.site/gZKm-Provable-Games-Buildathon-1a14e60564894ec59c919549f381a46c?p=4e4d1938a8ed4359be42e528fd6c6846&pm=c">Event & RISC Zero Track Info</a>
- <a target="_blank" href="https://zypher.network/">Zypher Homepage</a>
- RISC Zero [🪧 Presentation (Video & Sides)](./presentation.md)
Expand Down
6 changes: 4 additions & 2 deletions content/risc-zero/zypher-buildathon/slides.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Verifiable Games Using RISC Zero
tags: RISC Zero, Talk, Presentation, Workshop, zkVM, zkGames, Zypher, Hackathon, Buildathon, Zero Knowledge Proof, Applied Cryptography, Rust, Zypher
tags: RISC Zero, Talk, Presentation, Workshop, zkVM, zkGames, Hackathon, Buildathon, Zero Knowledge Proof, Applied Cryptography, Rust, Zypher
duration: 60 minuets
description: RISC Zero Workshop for the Zypher Provable Games Buildathon - June 2024
date: 2024-06-01
Expand All @@ -27,6 +27,8 @@ revealOptions:

<img rounded style="width: 50%; height: 230px; object-fit: cover;" src="./img/fusion-dragon-ball.gif" />

<!-- FIXME: Math doesn't render offline! jsdeliver hard coded.-->

**_On-chain_ $~~~$ 👉 $ZK$ 👈 $~~~$ _Off-chain_**

<a target="_blank" href="https://nuke-web3.github.io/book/risc-zero/zypher-buildathon/materials.html">Event Materials ↗️</a>
Expand Down Expand Up @@ -247,7 +249,7 @@ Notes:
- <a target="_blank" href="https://github.com/risc0/risc0-foundry-template">RISC Zero Foundry template</a>
<br/>&nbsp; Write unbounded programs that are low cost to verify on any EVM chain
- <a target="_blank" href="https://github.com/risc0/risc0-ethereum">Ethereum contracts, proof systems, and more</a>
<br/>&nbsp; View call proofs with **Steel**
<br/>&nbsp; View call proofs with **STEEL**
<br/>&nbsp; ZK Rollups & RollApps
<br/>&nbsp; ... Help us define more!

Expand Down

0 comments on commit 22bb7f5

Please sign in to comment.