Skip to content

Commit 8211ae4

Browse files
authored
feat: zk id (#14)
* feat: add lowlevel example * chore: add more realistic ix data * add manual hash example * feat: add example getting root from concurrent v1 state Merkle tree * add circuits with circom prover * groth16 solana * stash program impl * circuit tests pass * fixed test * chore: add versions, add readme, add ci setup * refactor: use randomness for trusted setup * refactor: hash merkle tree pubkey onchain, chore: update circuit readme * refactor: add secret to credential * update zk id readme
1 parent 0b38124 commit 8211ae4

22 files changed

Lines changed: 14596 additions & 0 deletions

.github/actions/setup/action.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ inputs:
2929
description: "Install Photon indexer (required for TypeScript tests)"
3030
required: false
3131
default: "false"
32+
circom-version:
33+
description: "Circom version for ZK circuits"
34+
required: false
35+
default: "v2.2.2"
36+
install-circom:
37+
description: "Whether to install circom and snarkjs"
38+
required: false
39+
default: "false"
3240

3341
runs:
3442
using: composite
@@ -100,6 +108,34 @@ runs:
100108
shell: bash
101109
run: npm install -g @lightprotocol/zk-compression-cli
102110

111+
- name: Cache Powers of Tau file
112+
if: inputs.install-circom == 'true'
113+
uses: actions/cache@v4
114+
with:
115+
path: ${{ inputs.example }}/pot/powersOfTau28_hez_final_16.ptau
116+
key: ptau-powersOfTau28_hez_final_16-v1
117+
118+
- name: Cache circom installation
119+
if: inputs.install-circom == 'true'
120+
id: cache-circom
121+
uses: actions/cache@v4
122+
with:
123+
path: ~/.cargo/bin/circom
124+
key: circom-${{ runner.os }}-${{ inputs.circom-version }}
125+
126+
- name: Install circom
127+
if: inputs.install-circom == 'true' && steps.cache-circom.outputs.cache-hit != 'true'
128+
shell: bash
129+
run: |
130+
wget -q https://github.com/iden3/circom/releases/download/${{ inputs.circom-version }}/circom-linux-amd64
131+
chmod +x circom-linux-amd64
132+
mv circom-linux-amd64 ~/.cargo/bin/circom
133+
134+
- name: Install snarkjs
135+
if: inputs.install-circom == 'true'
136+
shell: bash
137+
run: npm install -g snarkjs
138+
103139
- name: Install Photon indexer
104140
if: inputs.photon-indexer == 'true'
105141
shell: bash
@@ -122,3 +158,7 @@ runs:
122158
node --version
123159
npm --version
124160
fi
161+
if [ "${{ inputs.install-circom }}" == "true" ]; then
162+
circom --version
163+
snarkjs --help | head -1 || true
164+
fi

.github/workflows/rust-tests.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
- counter/native
3030
- counter/pinocchio
3131
- account-comparison
32+
- zk-id
3233
steps:
3334
- uses: actions/checkout@v4
3435

@@ -38,6 +39,12 @@ jobs:
3839
example: ${{ matrix.example }}
3940
solana-cli-version: ${{ env.SOLANA_CLI_VERSION }}
4041
rust-toolchain: ${{ env.RUST_TOOLCHAIN }}
42+
install-circom: ${{ matrix.example == 'zk-id' }}
43+
44+
- name: Setup ZK circuits
45+
if: matrix.example == 'zk-id'
46+
working-directory: ${{ matrix.example }}
47+
run: ./scripts/setup.sh
4148

4249
- name: Build and test
4350
working-directory: ${{ matrix.example }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ node_modules
66
test-ledger
77
.yarn
88
.claude
9+
build
10+
pot

zk-id/.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
node_modules/
2+
build/
3+
pot/
4+
*.sym
5+
*.r1cs
6+
*.wasm
7+
*.zkey
8+
*.wtns
9+
proof.json
10+
public.json

0 commit comments

Comments
 (0)