semaphore-protocol / semaphore

A zero-knowledge protocol for anonymous interactions.
https://semaphore.pse.dev
MIT License
872 stars 188 forks source link

semaphore-0.wasm not found #804

Closed Anas2001 closed 2 weeks ago

Anas2001 commented 2 weeks ago

Describe the bug When I try to generate a proof with @semaphore-protocol/proof package I get after while an Error Error: Failed to fetch https://unpkg.com/@zk-kit/semaphore-artifacts@4.0.0-beta.11/semaphore-0.wasm: Not Found

To Reproduce run this example

import { Identity } from "@semaphore-protocol/identity"; import { Group } from "@semaphore-protocol/group"; import { generateProof } from "@semaphore-protocol/proof";

const group = new Group(); const identity = new Identity("private_key_of_wallet"); group.addMember(identity.commitment); const proof = await generateProof(identity, group, 1, group.root); console.log(proof);

Expected behavior to log the proof

Screenshots no need for this

Technologies (please complete the following information):

Additional context try to call this link https://unpkg.com/@zk-kit/semaphore-artifacts@4.0.0-beta.11/semaphore-0.wasm from browser and get Cannot find "/semaphore-0.wasm" in @zk-kit/semaphore-artifacts@4.0.0-beta.11

vplasencia commented 2 weeks ago

Hey @Anas2001

Semaphore v4 does not support groups with one member. It supports groups with greater than or equal to 2 members. With one member in a group there is no anonymity, so it should be fine.

Do you need support for only one member in the group because of your use case?

If you add another member to the group, it should work fine. You may need to update the semaphore version to use the latest which is v4.0.0-beta.13.

Anas2001 commented 2 weeks ago

Hi @vplasencia

thanks for ur replay :) I wanted only to test the protocol on back-end and front-end. Of course I want to use it for multiple memebrs but the Error message didn't show me if it required at least 2 memebers to work fine. But I fixed the issue thru adding merkleTreeDepth to generateProof-Function const proof = await generateProof(identity, group, message, scope, merkleTreeDepth); and worked fine with only one member 👍 and yes I use the last version semaphore packages. I think you can close this issue but maybe will be better to update the docs bcz it took me a lot of time to figure it out.

vplasencia commented 2 weeks ago

Hey @Anas2001 it's great to know that you found out how to solve it. Yes, that's another way to make it work, by passing the merkle tree depth parameter. Thank you very much for pointing this out. I just created this issue: https://github.com/semaphore-protocol/semaphore/issues/805 to update the documentation to add more information about anonymity in groups and update the generateProof function to support tree depth 0 without passing the tree depth. Then for this case the function will use tree depth 1 directly and it will work.

I added the link of this issue there. Closing this issue, but feel free to add more ideas here or in the new issue. Thank you very much.