You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
_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
14
14
15
15
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:
16
16
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.
|[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 |
24
26
25
27
## Minesweeper example {#minesweeper}
26
28
@@ -32,7 +34,7 @@ This application is written using [MUD](https://mud.dev/), a framework that lets
32
34
33
35
To run the minesweeper example:
34
36
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).
36
38
37
39
2. Clone the repository.
38
40
@@ -47,15 +49,26 @@ To run the minesweeper example:
47
49
pnpm install
48
50
```
49
51
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.
51
64
52
65
```sh copy
53
-
pnpm dev
66
+
mprocs
54
67
```
55
68
56
69
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 forfile changes…_, the contracts are deployed and further progress will happenin the _server_ tab. There, you waituntil you get the message _Verifier address: 0x...._.
57
70
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.
0 commit comments