Skip to content

Commit d6106a5

Browse files
committed
Add tool versions and a few other updates
1 parent 8d19c03 commit d6106a5

File tree

1 file changed

+25
-12
lines changed
  • public/content/developers/tutorials/secret-state

1 file changed

+25
-12
lines changed

public/content/developers/tutorials/secret-state/index.md

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: Ori Pomerantz
55
tags: ["server", "offchain", "centralized", "zero-knowledge", "zokrates", "mud"]
66
skill: advanced
77
lang: en
8-
published: 2024-09-15
8+
published: 2025-03-15
99
---
1010

1111
_There are no secrets on the blockchain_. Everything that is posted on the blockchain is open to everybody to read. This is necessary, because the blockchain is based on anybody being able to verify it. However, games often rely on secret state. For example, the game of [minesweeper](<https://en.wikipedia.org/wiki/Minesweeper_(video_game)>) makes absolutely no sense if you can just go on a blockchain explorer and see the map.
@@ -14,13 +14,15 @@ The simplest solution is to use a [server component](/developers/tutorials/serve
1414

1515
After reading this article you will know how to create this kind of secret state holding server, a client for showing the state, and an onchain component for communication between the two. The main tools we use will be:
1616

17-
- [Zokrates](https://zokrates.github.io/) for zero-knowledge proofs and their verification.
18-
- [Typescript](https://www.typescriptlang.org/) for both the server and the client.
19-
- [Node](https://nodejs.org/en) for the server.
20-
- [Viem](https://viem.sh/) for communication with the Blockchain.
21-
- [MUD](https://mud.dev/) for onchain data management. Proper disclosure: While I'm writing this on my own time for Ethereum Foundation, my day job is working for [Lattice](https://lattice.xyz/) which makes this framework.
22-
- [React](https://react.dev/) for the user interface of the client.
23-
- [Vite](https://vitejs.dev/) for serving the client code.
17+
| Tool | Purpose | Verified on version |
18+
| --------------------------------------------- | ------------------------------------------------------- | ------------------: |
19+
| [Zokrates](https://zokrates.github.io/) | Zero-knowledge proofs and their verification | 1.1.9 |
20+
| [Typescript](https://www.typescriptlang.org/) | Programming language for both the server and the client | 5.4.2 |
21+
| [Node](https://nodejs.org/en) | Running the server | 20.18.2 |
22+
| [Viem](https://viem.sh/) | Communication with the Blockchain | 2.9.20 |
23+
| [MUD](https://mud.dev/) | Onchain data management | 2.0.12 |
24+
| [React](https://react.dev/) | Client user interface | 18.2.0 |
25+
| [Vite](https://vitejs.dev/) | Serving the client code | 4.2.1 |
2426

2527
## Minesweeper example {#minesweeper}
2628

@@ -32,7 +34,7 @@ This application is written using [MUD](https://mud.dev/), a framework that lets
3234

3335
To run the minesweeper example:
3436

35-
1. Make sure you [have the prerequisites installed](https://mud.dev/quickstart#prerequisites): [Node](https://mud.dev/quickstart#prerequisites), [Foundry](https://book.getfoundry.sh/getting-started/installation), [`git`](https://git-scm.com/downloads), and [`pnpm`](https://git-scm.com/downloads).
37+
1. Make sure you [have the prerequisites installed](https://mud.dev/quickstart#prerequisites): [Node](https://mud.dev/quickstart#prerequisites), [Foundry](https://book.getfoundry.sh/getting-started/installation), [`git`](https://git-scm.com/downloads), [`pnpm`](https://git-scm.com/downloads), and [`mprocs`](https://github.com/pvolok/mprocs).
3638

3739
2. Clone the repository.
3840

@@ -47,15 +49,26 @@ To run the minesweeper example:
4749
pnpm install
4850
```
4951

50-
4. Start the program (including an [anvil](https://book.getfoundry.sh/anvil/) blockchain) and wait.
52+
If Foundry was installed as part of `pnpm install`, you need to restart the command-line shell.
53+
54+
4. Compile the contracts
55+
56+
```sh copy
57+
cd packages/contracts
58+
forge build
59+
cd ../..
60+
```
61+
62+
63+
5. Start the program (including an [anvil](https://book.getfoundry.sh/anvil/) blockchain) and wait.
5164

5265
```sh copy
53-
pnpm dev
66+
mprocs
5467
```
5568

5669
Note that the startup takes a long time. To see the progress, first use the down arrow to scroll to the _contracts_ tab to see the MUD contracts being deployed. When you get the message _Waiting for file changes…_, the contracts are deployed and further progress will happen in the _server_ tab. There, you wait until you get the message _Verifier address: 0x...._.
5770

58-
5. Now you can browse to [the client](http://localhost:3000), click **New Game**, and start playing.
71+
6. Now you can browse to [the client](http://localhost:3000), click **New Game**, and start playing.
5972

6073
### Tables {#tables}
6174

0 commit comments

Comments
 (0)