ethereum / ethereum-org-website

Ethereum.org is a primary online resource for the Ethereum community.
https://ethereum.org/
MIT License
5.04k stars 4.78k forks source link

Suggest a tutorial: Using zero-knowledge for a secret state #13234

Open qbzzt opened 3 months ago

qbzzt commented 3 months ago

Tutorial title

Using zero-knowledge for a secret state

Tutorial description

Onchain games are limited because they cannot keep any hidden information. After reading this tutorial, a reader will be able to combine zero-knowledge proofs and server components (see https://github.com/ethereum/ethereum-org-website/pull/13228) to create verifiable games with a secret state, offchain, component.

The technique to do this will be demonstrated by creating a minesweeper game.

Tutorial tags

server, offchain, centralized, zero-knowledge

Skill level

Intermediate

Hosted on ethereum.org or hosted elsewhere?

Hosted on ethereum.org

For tutorials to be hosted on Ethereum.org: Tutorial Content

  1. Why do this? Why do games need a secret state?
  2. How can we trust it? Precommitments and zero-knowledge proofs.
  3. Minesweeper, a complete example.
    • The server
      • Reporting the hash of a randomly generated map.
      • Reporting a move's results.
      • The zero-knowledge component, using Cairo or Zokrates to prove that a map with hash H has n mines around location (x,y).
      • The onchain component
        • Relaying moves
        • Verifying zero-knowledge proofs
        • Relaying results
      • The client
        • How it works
  4. Design choice: should verification happen onchain or in the client?
  5. Conclusion: when is this the appropriate technique?

For tutorials hosted elsewhere: URL to tutorial

No response

Would you like to work on this issue?

wackerow commented 3 months ago

Hey @qbzzt! Thanks for the suggestion, this sounds like a cool tutorial. Will go ahead and assign you.

cc: @minimalsm

qbzzt commented 3 months ago

Thank you. BTW, I'll use Zokrates because Cairo doesn't seem to be something you can easily check on the EVM.

On Sat, Jun 29, 2024 at 1:06 PM Paul Wackerow @.***> wrote:

Hey @qbzzt https://github.com/qbzzt! Thanks for the suggestion, this sounds like a cool tutorial. Will go ahead and assign you.

cc: @minimalsm https://github.com/minimalsm

— Reply to this email directly, view it on GitHub https://github.com/ethereum/ethereum-org-website/issues/13234#issuecomment-2198280407, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADBCGGLS6EZWILSHFCCJRGDZJ3ZSTAVCNFSM6AAAAABJ2YCFPSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJYGI4DANBQG4 . You are receiving this because you were assigned.Message ID: @.***>

qbzzt commented 3 months ago

@wackerow , may I use MUD for this project? It's a framework that make dapp development easier (handles things like data storage and synchronization).

Proper disclosure: I work for the company that makes it, Lattice, although this will be an "own time" project, not part of my job duties.

qbzzt commented 2 months ago

I've already done 22 hours of work on this tutorial, and I'm nowhere near done. Sorry it's taking so long, but it's a complicated dapp to write and explain. It has three main components (server that holds the secret state, client with a UI, and the onchain component that facilitates communication between them), three computer languages (TypeScript, Zokrates, and Solidity), etc.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 30 days with no activity.

minimalsm commented 1 month ago

Hey @qbzzt, any update here?

qbzzt commented 1 month ago

Hey @qbzzt, any update here?

Close to done. You can see my draft at https://github.com/qbzzt/ethereum-org-website/blob/240714-zero-knowledge-state/public/content/developers/tutorials/secret-state/index.md . It's just taking longer than expected because it's complicated, I think it's the most complicated article I've written for ethereum.org.

github-actions[bot] commented 1 day ago

This issue is stale because it has been open 30 days with no activity.