aboutsummaryrefslogtreecommitdiff
path: root/zkvms/zkm/sdk/README.md
blob: 182111b02cf410a3be0c14f052f4503541bb2eab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
This is a copy of [ZKM's project SDK](https://github.com/zkMIPS/zkm-project-template/tree/main/sdk), which changes the zkVM cargo dependencies to point to `/nix/store`.
It is also used as a convinent place which stores the SDK's `libsnark` (`sdk/src/local/libsnark`), so during compilation it is not fetched from the source repo (refer to `zkvms/zkm/default.nix`).

---

# ZKM SDK usage

## Use the libsnark

1. The  compile.sh in the path sdk/src/local/libsnark only supports X86_64 linux.For MacOS, there is a [Dockerfile](../Dockerfile) in the template.
   
```
cd zkm-project-template/sdk/src/local/libsnark
./compile.sh
```
    If successful, it will generate the libsnark.so in sdk/src/local/libsnark/

2. To instruct your Rust environment on the location of the libsnark.so , you can set the LD_LIBRARY_PATH environment variable. For example:

```
export LD_LIBRARY_PATH=Your BASEDIR/zkm-project-template/sdk/src/local/libsnark:$LD_LIBRARY_PATH  
```

3. Import the SDK
   
```
// Cargo.toml
[dependencies]
zkm-sdk = { git = "https://github.com/zkMIPS/zkm-project-template", branch = "main", features = ["snark"] }
```

## Don't use the libsnark

1. Set the environment variable `NO_USE_SNARK=true` .
  
2. Import the SDK
   
```
// Cargo.toml
[dependencies]
zkm-sdk = { git = "https://github.com/zkMIPS/zkm-project-template", branch = "main" }
```