Compare commits

...

114 Commits

Author SHA1 Message Date
Vivian Plasencia
1dc597a175 chore: v4.14.0 2025-10-27 11:21:28 +01:00
Lautaro Di Sanza
b55bf7fd4d feat(data): add semaphore event listeners (#1054)
* feat(data): add semaphore event listeners

add listeners for groups and members

re #326

* feat(data): add semaphore event listeners

add listeners for ProoValidated and GroupAdminUpdated events

re #326

* feat(data): add semaphore event listeners

* feat(data): feat(data): add semaphore event listeners

the onMember method is separated and some names are adjusted

BREAKING CHANGE: N

re #326

* feat(data): feat(data): add semaphore event listeners

the onMember method is separated and some names are adjusted

BREAKING CHANGE: N

re #326

* feat(data): feat(data) add semaphore event listeners

add missing merkleTreeRoot element in onMember events

re #326

* feat(data): feat(data) add semaphore event listeners

fix name listener of GroupAdminUpdated event

re #326

* feat(data): feat(data) add semaphore event listeners

add groupId param to listener onGroupAdminUpdated

re #326

* feat(data): feat(data) add semaphore event listeners

Update method description

re #326

* feat(data): feat(data) add semaphore event listeners

fix descriptions

re #326

* feat(data): feat(data) add semaphore event listeners

Add short descriptions to off listeners methods

re #326
2025-10-24 00:13:58 +02:00
Cristian
496e18ecab fix(scripts): replaced map with foreach func (#1061)
fix: fix(scripts): replaced map with foreach func

re #1056
2025-10-23 12:46:53 +02:00
Vivian Plasencia
d4fb23a7af chore: update roadmap website and license year (#1060)
* chore(website): update roadmap

* chore(website): update license year 2024 -> 2025

re #947
2025-10-23 00:39:16 +02:00
Vivian Plasencia
411667f5c7 Dev (#1059)
* docs(proof): add documentation on terminating the bn128 curve to prevent resource leaks (#998)

* style(proof): format code with prettier

---------

Co-authored-by: VolodymyrBg <aqdrgg19@gmail.com>
2025-10-23 00:23:55 +02:00
bigbear
87709224a3 docs: fix incorrect default value in chunkArray JSDoc (#1038) 2025-10-22 11:14:46 +02:00
Fibonacci747
0e20c6884f docs(identity): correct @returns to bigint for secretScalar and commitment (#1028) 2025-10-22 11:12:23 +02:00
radik878
e1e893004d fix(data/ethers): correct MembersAdded map type to string[] (#1033) 2025-10-22 10:52:09 +02:00
Luciano Lupo
2e6bef51d4 docs(website): added Bring ID data to projects list (#1055)
re #1001
2025-10-22 10:32:30 +02:00
Vivian Plasencia
9e7b2900cf chore: v4.13.2 2025-10-13 10:31:58 +02:00
Vivian Plasencia
cd02f49173 feat: support gnosis-chiado and gnosis networks
re #1051
2025-10-12 21:25:10 -05:00
Vivian Plasencia
a8787bd1fc docs(website): add poll.cc (#1050)
docs(website): add poll.cc to website
2025-10-04 00:13:10 +02:00
Vivian Plasencia
2c6f7846d7 docs: update benachmarks page (#1045)
* docs(docs): update benchmarks page

re #1044

* docs(docs): update browser benchmarks

* docs(docs): update contracts image size

* docs(docs): update solidity benchmark info
2025-09-09 23:54:54 +02:00
Vivian Plasencia
8c359ad594 chore: v4.13.1 2025-09-08 15:02:57 +02:00
Vivian Plasencia
7ccb14d362 feat: deploy contracts (#1041) 2025-09-08 14:13:44 +02:00
Vivian Plasencia
7e60446268 docs: remove trusted setup from docs and website (#1039)
* docs(docs): remove trusted setup announcement from docs

* docs(website): remove trusted setup announcement from website
2025-09-02 15:45:47 +02:00
Vivian Plasencia
5dcba7fb2e chore: v4.13.0 2025-08-27 11:09:58 +02:00
Vivian Plasencia
0394caf2f7 feat: add production semaphore v4 zk artifacts (#1037) 2025-08-27 11:00:09 +02:00
Galoretka
820f34ac90 fix: improve error handling in toBigInt function (#1025)
* fix: improve error handling in toBigInt function

* Update packages/proof/src/to-bigint.ts

Co-authored-by: John Guilding <54913924+JohnGuilding@users.noreply.github.com>

---------

Co-authored-by: John Guilding <54913924+JohnGuilding@users.noreply.github.com>
2025-08-07 14:47:56 +02:00
Micke
81dbf8631c fix: optimize BigInt usage in hash function (#1003) 2025-08-06 23:13:58 +02:00
Vivian Plasencia
4e084b0589 docs(website): add noircon2 presentation video 2025-08-05 18:03:39 -05:00
Vivian Plasencia
210fed4a50 docs: update ceremony end date 2025-08-05 18:01:58 -05:00
Ocenka
53f41879d1 Fix invalid components in Chakra UI (#964)
* Update page.tsx

* Update page.tsx

* Update SectionBlock.tsx

* Update InfoCard.tsx

* Update ProjectsList.tsx

* Update Carousel.tsx

* Update InfoCard.tsx

* Update InfoCard.tsx
2025-08-05 22:26:25 +02:00
Vivian Plasencia
4089bbedc7 docs(docs): update ceremony closing time (#1021) 2025-08-04 23:37:12 +02:00
Vivian Plasencia
6a2b28c34e docs(docs): update deploy contracts command (#1019)
re #1018
2025-07-28 14:21:29 +02:00
Vivian Plasencia
dce9813c8e feat(docs): add trusted setup ceremony to docs (#1016)
* feat(docs): add trusted setup ceremony announcement to banner and new page with contribution steps

re #1014

* docs(docs): update ceremony settings section in trusted-setup file
2025-07-23 10:33:11 -05:00
Vivian Plasencia
aba32d83b1 feat(website): add trusted setup ceremony to website (#1015)
* feat(website): add trusted setup ceremony announcement to banner and events

re #1014

* docs(docs): update trusted setup ceremomy year in events

* docs(website): add exclamation mark to the banner
2025-07-23 10:08:51 -05:00
Vivian Plasencia
520a02698f chore: v4.13.0-beta.1 2025-07-23 14:07:30 +02:00
Vivian Plasencia
128cbcee13 refactor(contracts): update solidity version in contracts (#1013) 2025-07-23 12:55:00 +02:00
Wesley
a224f95d77 docs(docs): add llm setup docs (#993)
* docs(docs): add llm setup docs

* docs(docs): updated llms.txt to v4

updated llms.txt to only include Semaphore v4

---------

Co-authored-by: wslyvh <wslyvh@users.noreply.github.com>
2025-07-23 11:09:06 +02:00
Vivian Plasencia
bb089c5544 chore: v4.13.0-beta.0 2025-07-22 23:06:14 +02:00
Vivian Plasencia
88004d9092 fix: under constrained bug binary merkle root (#1012)
* Fix/update binary merkle root circuit version (#1000)

* fix(circuits)!: update binary merkle root circuit version

re #999

* chore: update snarkjs version from 0.7.4 to 0.7.5

* refactor: update the proof package and smart contracts  (#1011)

refactor: update the proof package and smart contracts with new zk artifacts
2025-07-22 23:02:00 +02:00
Vivian Plasencia
e7ca1d9487 chore: v4.12.1 2025-07-21 23:45:40 +02:00
Vivian Plasencia
1b82dcdded chore(group): update lean-imt version 2.2.3 -> 2.2.4 (#1010) 2025-07-21 16:36:43 -05:00
Vivian Plasencia
cd04b0c5c7 chore: v4.12.0 2025-07-17 16:38:26 +02:00
aritra
b6a7a9883b refactor: transport selection logic (#1007) 2025-07-17 16:30:04 +02:00
aritra
fc1fe4d086 Allow injecting existing PublicClient into SemaphoreViem (#1006)
* refactor: allow injecting existing PublicClient into SemaphoreViem

* fix: remove comment
2025-07-17 13:48:13 +02:00
Vivian Plasencia
feb8c9c97d docs(website): add ethdam video recording (#996) 2025-06-09 15:50:00 +02:00
César Henrique
b56e9690a8 Test(data): add test coverage for getEvents utility (#989)
test(data): add test coverage for getEvents utility

re #986
2025-05-26 19:10:24 +02:00
Vivian Plasencia
c973bab503 cocs: add new issue link (#988)
* docs: update contributing file

* docs: update pull request template

* docs: add new issue link to contributing
2025-05-25 23:14:11 +02:00
Vivian Plasencia
27aee4bf43 Docs/update contributing (#987)
* docs: update contributing file

* docs: update pull request template
2025-05-25 22:54:29 +02:00
Vivian Plasencia
ea62310df6 chore: v4.11.1 2025-05-21 16:49:07 +02:00
Vivian Plasencia
6bc415f4d5 fix(data): fix semaphore viem class (#985)
re #984
2025-05-21 16:44:38 +02:00
Vivian Plasencia
18f77ac0bb chore: v4.11.0 2025-05-20 14:00:27 +02:00
Sarkazein
f3c4cf27e2 feat(data): implement Viem lib alternative to SemaphoreEthers (#966)
* feat(data): implement Viem lib alternative to Ethers for @semaphore-protocol/data package class

This adds a Viem-based alternative to SemaphoreEthers, allowing
developers to choose their preferred Ethereum library.

Closes #343

* chore(data): update yarn.lock for viem dependency

* chore(data): improve test coverage for SemaphoreViem class

* chore(data): improve test coverage for SemaphoreViem class
2025-05-20 13:51:34 +02:00
Sri Hari S
57132a38df Added warning to the Semaphore docs (#983)
Update identities.mdx

Added warning to the Semaphore docs
2025-05-19 13:54:36 +02:00
Vivian Plasencia
6ef16976f7 docs(website): update semaphore roadmap (#981) 2025-05-07 14:42:59 +02:00
Vivian Plasencia
2849ca1d24 chore: v4.10.0 2025-05-06 22:36:52 +02:00
Vivian Plasencia
d05d783852 chore:deploy contracts (#980)
* chore: update semaphore contract address

re #978

* feat: add ethereum as a supported network

re #977

* feat: add ethereum subgraph and deploy subgraphs

re #978, #977
2025-05-06 22:28:08 +02:00
Vivian Plasencia
993e46a427 docs(website): update events (#979) 2025-05-05 19:03:45 +02:00
Jimmy Chu
f984c1e864 chore(website): add a new project in project page (#972) 2025-04-03 00:11:54 +02:00
Vivian Plasencia
5c9d1737d3 chore: v4.9.2 2025-03-31 12:50:00 +02:00
Vivian Plasencia
1318b0e74b docs: update releases section in readme file 2025-03-31 12:44:51 +02:00
Vivian Plasencia
c0fcc94e82 docs: add more info to the readme file about the release of the packages (#971) 2025-03-31 12:41:49 +02:00
Vivian Plasencia
e70ae1151b chore: update leanimt sol version (#970) 2025-03-31 12:30:58 +02:00
Vivian Plasencia
fd38539908 docs(website): add scaling semaphore with pir to the roadmap (#969) 2025-03-18 01:03:24 +01:00
Vivian Plasencia
8bd45d8c46 docs: add specification document link to website and docs (#965) 2025-03-06 13:55:29 +01:00
Vivian Plasencia
534e69683a docs(website): update roadmap to add semaphore noir implementation (#962) 2025-03-04 12:35:58 +01:00
Vivian Plasencia
a0a3b9380b docs(website): update spec status to true on roadmap (#959) 2025-03-03 11:02:33 +01:00
Vivian Plasencia
bc9f7df1da chore: v4.9.1 2025-02-24 23:19:29 +01:00
Vivian Plasencia
571ffdab0e chore(group): update leanimt package version (#957) 2025-02-24 23:15:07 +01:00
ewynx
773696f40c Fix broken link for LeanMIT (#956)
chore: fixes broken link for LeanMIT
2025-02-24 22:26:29 +01:00
Vivian Plasencia
f679583498 chore: v4.9.0 2025-02-03 13:26:48 +01:00
Vivian Plasencia
05926d0ef7 chore: update utils package version (#954) 2025-02-03 12:57:30 +01:00
Faezeh Shakouri
eef277281d Refactor/type-validation (#951)
* chore(data): add @zk-kit/utils dependency

* refactor(data): refactor parameter validation using @zk-kit/utils
2025-02-03 12:40:32 +01:00
Chidozie DAVID
b96467f3d4 revert(subgraph): reverses changes made (#952)
re #915
2025-02-03 12:35:25 +01:00
zanastas
e530412f27 Add new article (#918)
* Add new article

* Update apps/website/src/data/articles.json

remove referral link

Co-authored-by: Vivian Plasencia <v.pcalana@gmail.com>

---------

Co-authored-by: Vivian Plasencia <v.pcalana@gmail.com>
2025-01-29 00:04:39 +01:00
Vivian Plasencia
4df7693367 chore(subgraph): update matchstick-as dependency (#946)
* chore(subgraph): update matchstick-as dependency

* chore(subgraph): update dependency versions

* ci: update pull request workflow to install libssl1.1 before testing the subgraph

* ci: update pull requests workflow

* ci: update ubuntu version

* ci: update ubuntu version in tests

* ci: update ubuntu version
2025-01-27 14:47:11 +01:00
Sumit Vekariya
0ca80ca716 docs: fixed circuit logic url (#931)
fix: circuit logic url
2025-01-27 13:13:39 +01:00
youyyytrok
ed8141e873 docs: fix broken link and typo correction (#923)
* broken redirect CONTRIBUTING.md

* typo README.md
2025-01-27 13:10:57 +01:00
Vivian Plasencia
0f4aca3ded docs: make year update dynamically on website and docs (#945)
* docs: make year update dynamically on website and docs

* docs(docs): make year update dynamically
2025-01-20 21:45:32 +01:00
Vivian Plasencia
6e2ef756bc docs(website): update roadmap (#943)
docs(website): update roadmap on the website
2025-01-20 19:59:46 +01:00
hanghuge
c2dce437b4 chore: fix 404 status URL (#917)
Signed-off-by: hanghuge <cmoman@outlook.com>
2025-01-20 12:43:47 +00:00
0xpanoramix
8b91d75c6f feat(website): add obscurus to projects section (#941)
re #939
2025-01-20 13:06:46 +01:00
Vivian Plasencia
abfcf9f006 docs: update contributing and pull_request_template files 2025-01-14 15:10:17 +01:00
Vivian Plasencia
a2e8f5a15c chore: v4.8.2 2024-12-18 13:06:36 +01:00
Vivian Plasencia
f77df8d98f fix: include solhint config file in contracts templates (#929) 2024-12-18 13:01:35 +01:00
Vivian Plasencia
2b9fde2676 chore: v4.8.1 2024-12-18 11:41:01 +01:00
Vivian Plasencia
ac4ddfc6eb chore(cli-template-contracts-foundry): add prepublish script (#927)
chore(cli-template-contracts-foundry): add prepublish script to publish foundry template
2024-12-18 11:32:36 +01:00
Vivian Plasencia
afae06e8e1 chore: v4.8.0 2024-12-17 15:06:02 +01:00
Jimmy Chu
4cc6980b55 Add CLI Foundry Template (cont.) (#905)
* Semaphore identity example code bug fix

* Receive suggestion for consistency

* chore: forge init

* forge install: forge-std

v1.9.2

* Foundry CLI First Draft

* modules

* forge install: semaphore

v4.0.3

* forge install: zk-kit.solidity

* forge install: poseidon-solidity

v0.0.5

* forge install: openzeppelin-contracts

v5.0.2

* modules

* forge install: semaphore

v4.0.3

* forge install: zk-kit.solidity

* forge install: poseidon-solidity

v0.0.5

* forge install: openzeppelin-contracts

v5.0.2

* modules

* forge install: semaphore

v4.0.3

* forge install: zk-kit.solidity

* forge install: poseidon-solidity

v0.0.5

* forge install: openzeppelin-contracts

v5.0.2

* modules

* forge install: semaphore

v4.0.3

* forge install: zk-kit.solidity

* forge install: poseidon-solidity

v0.0.5

* forge install: openzeppelin-contracts

v5.0.2

* modules

* forge install: semaphore

v4.0.3

* forge install: zk-kit.solidity

* forge install: poseidon-solidity

v0.0.5

* forge install: openzeppelin-contracts

v5.0.2

* modules

* forge install: semaphore

v4.0.3

* forge install: zk-kit.solidity

* forge install: poseidon-solidity

v0.0.5

* forge install: openzeppelin-contracts

v5.0.2

* forge install: forge-std

v1.9.2

* modules

* forge install: semaphore

v4.0.3

* forge install: zk-kit.solidity

* forge install: poseidon-solidity

v0.0.5

* forge install: openzeppelin-contracts

v5.0.2

* modules

* forge install: semaphore

v4.0.3

* forge install: zk-kit.solidity

* forge install: poseidon-solidity

v0.0.5

* forge install: openzeppelin-contracts

v5.0.2

* forge install: forge-std

v1.9.2

* modules

* forge install: semaphore

v4.0.3

* forge install: zk-kit.solidity

* forge install: poseidon-solidity

v0.0.5

* forge install: openzeppelin-contracts

v5.0.2

* forge install: forge-std

v1.9.2

* modules

* forge install: semaphore

v4.0.3

* forge install: zk-kit.solidity

* forge install: poseidon-solidity

v0.0.5

* forge install: openzeppelin-contracts

v5.0.2

* modules

* forge install: semaphore

v4.0.3

* forge install: zk-kit.solidity

* forge install: poseidon-solidity

v0.0.5

* forge install: openzeppelin-contracts

v5.0.2

* forge install: forge-std

v1.9.2

* modules

* forge install: semaphore

v4.0.3

* forge install: zk-kit.solidity

* forge install: poseidon-solidity

v0.0.5

* forge install: openzeppelin-contracts

v5.0.2

* forge install: forge-std

v1.9.2

* change test name

* modify declaration of semaphore and verifier

* Modify Test Function Name

* Add Test Chain Target

* forge std install

* refactor(cli-template-contracts-foundry): change default Anvil address and private key

* chore(cli-template-contracts-foundry): add comments

* refactor(cli-template-contracts-foundry): add Semaphore & SemaphoreVerifier addresses for test chain

* chore(cli-template-contracts-foundry): add forge coverage for Makefile

* chore(cli-template-contracts-foundry): add env.example

* docs(cli-template-contracts-foundry): add command instructions

* updated

* forge build works

* Fixed for linting

* chore(cli-template-contracts-foundry): make the lint, prettier, and lint-staged pass

* chore(cli-template-contracts-foundry): replace Makefile(removed) with package.json

* chore(cli-template-contracts-foundry): passing the ci test

* updated test

* feat(cli-template-contracts-foundry): complete cli-template-contracts-foundry

re #854, #185

* Update dependencies

* Add explanation on `yarn dev`

* fix(cli-template-contracts-foundry): fix `yarn dev` command and add docs on integrate w/ boilerplate

* Added yarnrc

* updated version

* Added Foundry in template option

---------

Co-authored-by: weipooppys93030 <55434365+weipooppys93030@users.noreply.github.com>
Co-authored-by: timou0911 <x0928048316@gmail.com>
Co-authored-by: csiejimmyliu <91661606+csiejimmyliu@users.noreply.github.com>
2024-12-17 14:48:36 +01:00
cedoor
6b04ec0eca chore: v4.7.3 2024-12-12 08:55:13 +00:00
Jake C-T
13a9480165 fix(core): bump ethers to v6.13.4 (#921)
Update ethers version to resolve ws security issue (CVE-2024-37890).
Move contract address check outside of branch statement so Typescript can see.
Add build instructions to setup to resolve 'Cannot find module '@semaphore-protocol/...' when
running tests for the first time.

re #920
2024-12-12 08:53:17 +00:00
cedoor
53967a9a3c chore: v4.7.2 2024-12-09 10:44:07 +01:00
Lautaro Di Sanza
5b92c0a2bc fix(group): after a sequence of updates a proof is invalid (#910)
* fix(group): after a sequence of updates a proof is invalid

* fix(group): after a sequence of updates a proof is invalid
2024-12-09 10:43:08 +01:00
Dmytrol
31c776ea68 Fix Typo in Quick Setup Documentation (#916)
typos quick-setup.md
2024-12-06 10:05:56 +05:30
Vivian Plasencia
8d83d59220 chore: v4.7.1 2024-12-05 18:49:30 +01:00
Vivian Plasencia
9e4fb5376c chore: update subgraph versions (#913)
re #912
2024-12-05 18:45:49 +01:00
Vivian Plasencia
745edb8e92 chore(website): add ethindia event to the website (#911) 2024-12-04 19:15:22 +01:00
Cypher Pepe
e732992952 docs: Typo Fixes and Documentation Updates (#907)
* typo howitworks.md

* typos libsemaphore.md

* typos what-is-semaphore.md

* typo subgraph.md

* typo identities.mdx

* typo proofs.mdx

* typos page.tsx

* typo page.tsx
2024-12-02 14:35:45 +07:00
Dmitry
3fcce15375 Fix typo in section.identities.box2.description Update code.json (#909)
Correct "identtity" to "identity"
2024-12-02 14:34:08 +07:00
Cedoor
ebb6731d89 docs(subgraph): update README.md (#906)
* docs(subgraph): update README.md

* docs(subgraph): update README.md
2024-11-28 18:02:55 +07:00
wangjingcun
0c23acf9cf chore: fix 404 status URL (#904)
Signed-off-by: wangjingcun <wangjingcun@aliyun.com>
2024-11-28 14:57:10 +07:00
cedoor
3e7db08eeb chore: v4.7.0 2024-11-27 17:24:57 +07:00
Cedoor
8adfc30da8 chore(contracts): add scroll sepolia to supported networks (#902)
* chore(contracts): add scroll sepolia to supported networks

* chore(contracts): deploy contracts on scroll sepolia

re #899

* chore(contracts): deploy semaphore on correct scroll sepolia network

re #899
2024-11-27 17:24:08 +07:00
sripwoud
42639662c3 docs: add soldeer install instructions (#903)
* docs: add  `soldeer` install instructions

* update README
2024-11-27 12:36:36 +07:00
Shikhar Singh
64025516c0 feat: clean node_modules before building subgraph (#884)
* feat(cli): remove @semaphore-protocol/cli prepublish script

The idea is to remove the prepublish script from the scripts object of the package.json file of
every cli template when the template is downloaded using the CLI.

BREAKING CHANGE: n

* refactor(cli): add comment

* refactor(cli): create seperate file for removePrePublishScript function

* refactor(cli): using updatedPackageJsonContent var instead of calling readFileSync again

* fix(subgraph): clean node_modules before building subgraph

* refactor(subgraph): fix: test typo

* refactor(subgraph): refactor: remove nohoist

* refactor(subgraph): refactor: workspaces structure
2024-11-26 09:42:42 +01:00
sripwoud
91f8a4be2a fix(ci): publish pkg if no releases yet (#900)
* fix(ci): publish pkg if no releases yet

* chore(ci): add workflow release trigger

* fix: workflow dispatch instead of workflow release
2024-11-26 15:21:07 +07:00
Bryer
ebd9a27c1b typo fix Update CONTRIBUTING.md (#901)
Corrected phrasing in "Commit rules" section
2024-11-26 15:20:14 +07:00
cedoor
bada8b8792 chore: v4.6.0 2024-11-25 13:09:50 +07:00
Cedoor
e93b19c566 chore(contracts): deploy contracts (#892)
* chore(contracts): deploy contracts

* chore(subgraph): deploy new subgraphs
2024-11-25 13:08:31 +07:00
leopardracer
862f715d05 fix: typos in documentation files (#898)
* Update usage.md

* Update glossary.md
2024-11-25 12:42:49 +07:00
Dmitry
3ed6c38587 Fixed closing tag issue in Update README.md (#894)
In the table section, there is a minor mistake in the closing tag. Instead of using </tbody>, it should be </tbody>. This is a formatting mistake.
2024-11-20 15:53:14 +07:00
Cedoor
7e183f3d2c refactor(contracts): support version range (#891)
re #888
2024-10-31 13:19:05 +00:00
Jimmy Chu
901d0954c0 refactor(contracts): specify gas cost in SemaphoreVerifier precompile calls (#883)
* chore(contracts): remove sub() from gas() in staticcall at SemaphoreVerifier

re #871

* refactor(contracts): using fixed gas cost on precompile calls

re #871

* refactor(contracts): increease fixed gas cost with safety buffer
2024-10-31 12:35:19 +00:00
Erick Vasquez
caebc1a4ab feat: add veilescrow to projects section (#890) 2024-10-30 18:46:38 +01:00
Vivian Plasencia
9b419f0c78 docs: add benchmarks page (#889)
* docs(docs): add benchmarks page to the docs

re #815

* chore(docs): update the docusaurus version
2024-10-30 10:54:13 +01:00
Vivian Plasencia
c67b888eb6 chore: v4.5.0 2024-10-28 20:23:40 +01:00
Vivian Plasencia
376cd11808 docs(identity): add export import identity to the docs (#887)
re #872
2024-10-28 13:29:35 +01:00
Vivian Plasencia
58132a9478 feat(identity): export point and signature types (#886)
* feat(identity): export point and signature types

re #885

* docs(identity): add the generate commitment function to the readme file
2024-10-28 13:29:03 +01:00
Vivian Plasencia
fadcf19206 chore: v4.4.2 2024-10-23 22:42:39 +02:00
Shikhar Singh
3be17268ab feat: remove prepublish script when creating template with Semaphore CLI (#882)
* feat(cli): remove @semaphore-protocol/cli prepublish script

The idea is to remove the prepublish script from the scripts object of the package.json file of
every cli template when the template is downloaded using the CLI.

BREAKING CHANGE: n

* refactor(cli): add comment

* refactor(cli): create seperate file for removePrePublishScript function

* refactor(cli): using updatedPackageJsonContent var instead of calling readFileSync again
2024-10-23 22:07:48 +02:00
Vivian Plasencia
82cdc60af6 fix: update shebang lines in the ts scripts (#881)
re #880
2024-10-23 10:50:46 +01:00
sripwoud
6c9ede6931 ci: install soldeer in release workflow (#867)
* ci: install `soldeer` in release workflow

* ci: setup soldeer login file (#868)

* chore: trigger release workflow

* chore: format

* ci: set `soldeer` credentials in github workspace

* chore: remove commentouts

* chore: add back tag trigger
2024-10-22 09:20:34 +01:00
154 changed files with 9056 additions and 3068 deletions

View File

@@ -29,10 +29,12 @@
<!-- Please check if the PR fulfills these requirements. -->
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] My changes generate no new warnings
- [ ] I have run `yarn format` and `yarn lint` without getting any errors
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
> [!IMPORTANT]
> We do not accept pull requests for minor grammatical fixes (e.g., correcting typos, rewording sentences) or for fixing broken links, unless they significantly improve clarity or functionality. These contributions, while appreciated, are not a priority for merging. If you notice any of these issues, please create a [GitHub Issue](https://github.com/semaphore-protocol/semaphore/issues/new?template=BLANK_ISSUE) to report them so they can be properly tracked and addressed.

View File

@@ -34,7 +34,7 @@ jobs:
run: yarn lint
test-subgraph:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04 # Context: https://github.com/graphprotocol/graph-tooling/issues/1546#issuecomment-2589680195
steps:
- uses: actions/checkout@v4

View File

@@ -75,7 +75,7 @@ jobs:
run: yarn run eslint ${{ steps.changed-files.outputs.to_lint_all_changed_files }} --ext .cjs,.js,.jsx,.ts,.tsx
test:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04 # Context: https://github.com/graphprotocol/graph-tooling/issues/1546#issuecomment-2589680195
steps:
- uses: actions/checkout@v4

View File

@@ -4,6 +4,7 @@ permissions:
contents: write
on:
workflow_dispatch:
push:
tags:
- "v*"
@@ -17,6 +18,16 @@ jobs:
with:
fetch-depth: 0
- name: Install soldeer
uses: taiki-e/install-action@v2
with:
tool: soldeer
- name: Store soldeer login credential
env:
SOLDEER_TOKEN: ${{ secrets.SOLDEER_TOKEN }}
run: |
echo "$SOLDEER_TOKEN" > "$GITHUB_WORKSPACE"/soldeer_login
- name: Install Node.js
uses: actions/setup-node@v4
with:
@@ -37,6 +48,7 @@ jobs:
run: yarn version:publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
SOLDEER_LOGIN_FILE: ${{ github.workspace }}/soldeer_login
- run: yarn version:release
env:

View File

@@ -22,7 +22,7 @@ Pull requests are great if you want to add a feature or fix a bug. Here's a quic
3. Add a test for your change. Only refactoring and documentation changes require no new tests.
4. Make sure to check out the [Style Guide](/CONTRIBUTING#style-guide) and ensure that your code complies with the rules.
4. Make sure to check out the [Style Guide](/CONTRIBUTING.md#style-guide) and ensure that your code complies with the rules.
5. Make the test pass.
@@ -30,6 +30,9 @@ Pull requests are great if you want to add a feature or fix a bug. Here's a quic
7. Push to your fork and submit a pull request on our `main` branch. Please provide us with some explanation of why you made the changes you made. For new features make sure to explain a standard use case to us.
> [!IMPORTANT]
> We do not accept pull requests for minor grammatical fixes (e.g., correcting typos, rewording sentences) or for fixing broken links, unless they significantly improve clarity or functionality. These contributions, while appreciated, are not a priority for merging. If you notice any of these issues, please create a [GitHub Issue](https://github.com/semaphore-protocol/semaphore/issues/new?template=BLANK_ISSUE) to report them so they can be properly tracked and addressed.
## CI (Github Actions) Tests
We use GitHub Actions to test each PR before it is merged.
@@ -42,7 +45,7 @@ When you submit your PR (or later change that code), a CI build will automatical
We always use ESLint and Prettier. To check that your code follows the rules, simply run the npm script `yarn lint`.
### Commits rules
### Commit rules
For commits it is recommended to use [Conventional Commits](https://www.conventionalcommits.org).

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024 Ethereum Foundation
Copyright (c) 2025 Ethereum Foundation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -264,7 +264,7 @@ The core of the Semaphore protocol is in the [circuit logic](/packages/circuits/
</a>
</td>
</tr>
<tbody>
</tbody>
</table>
## 🛠 Install
@@ -275,12 +275,18 @@ Clone this repository:
git clone https://github.com/semaphore-protocol/semaphore.git
```
And install the dependencies:
Install the dependencies:
```bash
cd semaphore && yarn
```
And build the repository:
```bash
yarn build
```
## 📜 Usage
Copy the `.env.example` file as `.env`:
@@ -367,12 +373,28 @@ The output will be placed on the `docs` folder.
### Releases
Bump a new version with:
Steps:
1. Bump a new version with:
```bash
yarn version:bump <version>
# e.g. yarn version:bump 2.0.0
```
It will create a commit and a git tag that will need to be pushed on the main branch. A workflow will be triggered and will
publish the Semaphore packages on [npm](https://www.npmjs.com/) and release a new version on Github with its changelogs automatically.
This step creates a commit and a git tag.
2. Push the changes to main:
```bash
git push origin main
```
3. Push the new git tag:
```bash
git push origin <version>
# e.g. git push origin v2.0.0
```
After pushing the new git tag, a workflow will be triggered to publish the Semaphore packages on [npm](https://www.npmjs.com/) and release a new version on GitHub with its changelogs automatically.

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

View File

@@ -390,8 +390,5 @@
},
"footer.right.connect.link2": {
"message": "X (Twitter)"
},
"footer.copyright": {
"message": "Copyright © 2024 Ethereum Foundation"
}
}

View File

@@ -42,7 +42,7 @@
"message": "Valores públicos"
},
"section.identities.box2.description": {
"message": "Semaphore utiliza la función hash Poseidon para crear el identtity commitment a partir de los valores privados. Los identity commitments se pueden compartir públicamente, de forma similar a las direcciones Ethereum."
"message": "Semaphore utiliza la función hash Poseidon para crear el identity commitment a partir de los valores privados. Los identity commitments se pueden compartir públicamente, de forma similar a las direcciones Ethereum."
},
"section.identities.box3.title": {
"message": "Generar identidades"
@@ -390,8 +390,5 @@
},
"footer.right.connect.link2": {
"message": "X (Twitter)"
},
"footer.copyright": {
"message": "Copyright © 2024 Ethereum Foundation"
}
}

View File

@@ -12,6 +12,6 @@ as well as relevant circuits in
which the Semaphore zk-SNARK uses.
The summary of the audit results can be found
[here](https://github.com/appliedzkp/semaphore/tree/master/audit). After three
[here](https://github.com/semaphore-protocol/semaphore/blob/main/apps/docs/versioned_docs/version-V1/audit.md). After three
rounds of fixes, all security and performance issues were fixed, and the few
remaining issues are minor and do not affect security.

View File

@@ -58,7 +58,7 @@ Hardhat includes the Hardhat Network, a local Ethereum network for development.
## Install Semaphore packages
Semaphore provides contracts, JavaScript libraries and an Hardhat plugin for developers building zero-knowledge applications.
Semaphore provides contracts, JavaScript libraries and a Hardhat plugin for developers building zero-knowledge applications.
- `@semaphore-protocol/contracts` provides contracts to manage groups and verify Semaphore proofs on-chain.
- JavaScript libraries help developers build zero-knowledge applications.

View File

@@ -19,7 +19,7 @@ Para utilizar los contratos e interfaces Semaphore en su proyecto, instale el pa
Semaphore ofrece los siguientes contratos base:
- [`SemaphoreVerifier.sol`](https://github.com/semaphore-protocol/semaphore/blob/main/packages/contracts/base/SemaphoreVerifier.sol): contiene una función para verificar pruebas Semaphore;
- [`SemaphoreVerifier.sol`](https://github.com/semaphore-protocol/semaphore/blob/v3.15.2/packages/contracts/contracts/base/SemaphoreVerifier.sol): contiene una función para verificar pruebas Semaphore;
- [`SemaphoreGroups.sol`](https://github.com/semaphore-protocol/semaphore/blob/main/packages/contracts/base/SemaphoreGroups.sol): contiene las funciones para crear grupos y añadir/remover/actualizar miembros.
Los contratos base están relacionados de forma muy cercana al protocolo.

View File

@@ -16,10 +16,10 @@
"format:write": "remark ./**/*.mdx --output"
},
"dependencies": {
"@docusaurus/core": "3.1.1",
"@docusaurus/preset-classic": "3.1.1",
"@docusaurus/core": "3.5.2",
"@docusaurus/preset-classic": "3.5.2",
"@mdx-js/react": "^3.0.0",
"@semaphore-protocol/utils": "4.4.1",
"@semaphore-protocol/utils": "4.14.0",
"@svgr/webpack": "^5.5.0",
"clsx": "^1.2.1",
"docusaurus-plugin-sass": "^0.2.5",
@@ -31,8 +31,8 @@
"url-loader": "^4.1.1"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.1.1",
"@docusaurus/tsconfig": "3.1.1",
"@docusaurus/module-type-aliases": "3.5.2",
"@docusaurus/tsconfig": "3.5.2",
"@types/react": "^18.2.29",
"remark-cli": "^12.0.0",
"remark-frontmatter": "^5.0.0",

View File

@@ -54,11 +54,7 @@ function Footer() {
<hr />
<div>
<p>
{translate({
id: "footer.copyright"
})}
</p>
<p>Copyright © {new Date().getFullYear()} Ethereum Foundation</p>
<Logo
style={{ marginRight: -8 }}

196
apps/docs/static/llms.txt vendored Normal file
View File

@@ -0,0 +1,196 @@
# Semaphore V4 - llms.txt
> Zero-knowledge protocol for anonymous group membership and signaling
## Quick Reference
### Core Concept
Semaphore allows users to cast messages (votes, endorsements) as provable group members without revealing identity, with built-in double-signaling prevention.
**Key Components:**
- **Identity**: User's cryptographic identity (private key, public key, commitment)
- **Group**: Merkle tree of identity commitments
- **Proof**: Zero-knowledge proof of group membership + message
- **Nullifier**: Unique identifier preventing double-signaling
- **Scope**: Topic/context that limits one proof per user
### Essential Packages
```bash
# Core functionality
npm install @semaphore-protocol/core
# Individual packages
npm install @semaphore-protocol/identity
npm install @semaphore-protocol/group
npm install @semaphore-protocol/proof
npm install @semaphore-protocol/contracts
```
## Common Patterns
### 1. Identity Management
```javascript
import { Identity } from "@semaphore-protocol/identity"
// Random identity
const identity = new Identity()
const { privateKey, publicKey, commitment } = identity
// Deterministic identity (from secret)
const deterministicIdentity = new Identity("secret-value")
// Sign/verify messages
const message = "Hello World"
const signature = identity.signMessage(message)
const isValid = Identity.verifySignature(message, signature, identity.publicKey)
// Export/import
const exported = identity.export() // base64 private key
const imported = Identity.import(exported)
```
### 2. Group Operations
```javascript
import { Group } from "@semaphore-protocol/group"
// Create group
const group = new Group()
const groupWithMembers = new Group([commitment1, commitment2])
// Manage members
group.addMember(identity.commitment)
group.addMembers([commitment1, commitment2])
group.removeMember(0) // sets to 0, doesn't change size
group.updateMember(0, newCommitment)
// Generate Merkle proof
const merkleProof = group.generateMerkleProof(0)
```
### 3. Proof Generation & Verification
```javascript
import { generateProof, verifyProof } from "@semaphore-protocol/proof"
// Generate proof
const scope = group.root // or any unique scope
const message = 1
const proof = await generateProof(identity, group, message, scope)
// Verify proof
const isValid = await verifyProof(proof)
```
### 4. On-Chain Integration
```solidity
// Contract setup
import "@semaphore-protocol/contracts/interfaces/ISemaphore.sol";
contract YourContract {
ISemaphore public semaphore;
uint256 public groupId;
constructor(ISemaphore _semaphore) {
semaphore = _semaphore;
groupId = semaphore.createGroup();
}
// Validate proof on-chain
function validateProof(ISemaphore.SemaphoreProof calldata proof) external {
semaphore.validateProof(groupId, proof);
}
}
```
## Configuration Reference
### Circuit Parameters
- **MAX_DEPTH**: 1-32 (Merkle tree depth)
- **Default proof validity**: 1 hour for old Merkle roots
### Key Security Settings
- **Identity reuse warning**: Same identity across groups compromises all groups
- **Nullifier uniqueness**: Prevents double-signaling within same scope
- **Message tampering**: Circuit calculates dummy square to prevent tampering
## Troubleshooting
### Common Issues
**"Proof verification failed"**
- Check group contains identity commitment
- Verify scope matches between generation and verification
- Ensure Merkle proof is current (within validity window)
**"Nullifier already exists"**
- User already submitted proof with this scope
- Use different scope or implement nullifier tracking
**"Identity commitment not found"**
- Add identity to group before generating proof
- Verify correct group is being used
## Architecture Overview
### Circuit Structure
The Semaphore circuit proves three things:
1. **Membership**: User belongs to group (Merkle proof verification)
2. **Authorization**: Same user created message and proof (nullifier check)
3. **Message integrity**: Message hasn't been tampered with
### Contract Architecture
- **SemaphoreVerifier.sol**: Groth16 proof verification
- **SemaphoreGroups.sol**: Group management (abstract)
- **Semaphore.sol**: Complete implementation with proof validation
## Extended Resources
### 📚 Complete Guides
- [Getting Started Tutorial](https://docs.semaphore.pse.dev/getting-started) - Full project setup with CLI
- [Identities Deep Dive](https://docs.semaphore.pse.dev/guides/identities) - Advanced identity management
- [Groups Management](https://docs.semaphore.pse.dev/guides/groups) - Comprehensive group operations
- [Proof Generation](https://docs.semaphore.pse.dev/guides/proofs) - Detailed proof workflows
### 🔧 Technical References
- [Semaphore V4 Specification](https://github.com/zkspecs/zkspecs/blob/main/specs/3/README.md) - Protocol specification
- [Circuit Documentation](https://docs.semaphore.pse.dev/technical-reference/circuits) - Circuit internals
- [Contract Reference](https://docs.semaphore.pse.dev/technical-reference/contracts) - Solidity implementation details
- [Deployed Contracts](https://docs.semaphore.pse.dev/deployed-contracts) - Network addresses
### 🛠️ Development Tools
- [GitHub Repository](https://github.com/semaphore-protocol/semaphore) - Source code and examples
- [CLI Templates](https://github.com/semaphore-protocol/semaphore/tree/main/packages/cli) - Project boilerplates
- [Boilerplate App](https://github.com/semaphore-protocol/boilerplate) - Complete example application
### 🔐 Security & Audits
- [Trusted Setup Ceremony](https://ceremony.pse.dev/projects/Semaphore%20V4%20Ceremony) - 400+ participants, July 2024
- [Security Audits](https://docs.semaphore.pse.dev/#audits) - PSE and Veridise audit reports
- [Best Practices Guide](https://docs.semaphore.pse.dev/) - Security considerations section
### 🌐 Community & Support
- [Documentation](https://docs.semaphore.pse.dev/) - Complete documentation
- [GitHub Discussions](https://github.com/semaphore-protocol/semaphore/discussions) - Community support
- [PSE Website](https://pse.dev/) - Privacy & Scaling Explorations team
### 📊 Data & Indexing
- [@semaphore-protocol/data](https://github.com/semaphore-protocol/semaphore/tree/main/packages/data) - On-chain data fetching
- [Subgraph Templates](https://github.com/semaphore-protocol/semaphore/tree/main/packages/cli-template-monorepo-subgraph) - Graph Protocol integration
## Quick Start Commands
```bash
# Create new project
npx @semaphore-protocol/cli create my-app --template monorepo-ethers
# Get on-chain groups
semaphore get-groups --network sepolia
# Deploy contract
yarn deploy --semaphore <address> --group <id> --network sepolia
```
## Use Cases
- **Private Voting**: Anonymous ballots with double-vote prevention
- **Whistleblowing**: Anonymous reporting with verified membership
- **Anonymous DAOs**: Governance without identity disclosure
- **Mixers**: Privacy-preserving value transfers
- **Anonymous Authentication**: Prove membership without revealing identity

View File

@@ -12,6 +12,6 @@ as well as relevant circuits in
which the Semaphore zk-SNARK uses.
The summary of the audit results can be found
[here](https://github.com/appliedzkp/semaphore/tree/master/audit). After three
[here](https://github.com/semaphore-protocol/semaphore/blob/main/apps/docs/versioned_docs/version-V1/audit.md). After three
rounds of fixes, all security and performance issues were fixed, and the few
remaining issues are minor and do not affect security.

View File

@@ -121,7 +121,7 @@ authenticity of the signal and prevents front-running attacks.
## Cryptographic primitives
Semaphore uses MiMC for the Merkle tree, Pedersen commmitments for the identity
Semaphore uses MiMC for the Merkle tree, Pedersen commitments for the identity
commitments, Blake2 for the nullifiers hash, and EdDSA for the signature.
MiMC is a relatively new hash function. We use the recommended MiMC

View File

@@ -145,7 +145,7 @@ Returns `false` otherwise.
**`signMsg(privKey: EddsaPrivateKey, msg: SnarkBigInt): EdDSAMiMcSpongeSignature)`**
Encapsualtes `circomlib.eddsa.signMiMCSponge` to sign a message `msg` using private key `privKey`.
Encapsulates `circomlib.eddsa.signMiMCSponge` to sign a message `msg` using private key `privKey`.
**`verifySignature(msg: SnarkBigInt, signature: EdDSAMiMcSpongeSignature, pubKey: EddsaPublicKey)`: boolean**
@@ -190,7 +190,7 @@ const genWitness = async (
- `circuit` is the output of `genCircuit()`.
- `identity` is the `Identity` whose identity commitment you want to prove is
in the set of registered identities.
- `idCommitments` is an array of registered identity commmitments; i.e. the
- `idCommitments` is an array of registered identity commitments; i.e. the
leaves of the tree.
- `treeDepth` is the number of levels which the Merkle tree used has
- `externalNullifier` is the current external nullifier
@@ -212,7 +212,7 @@ Only `witness` is essential to generate the proof; the other data is only
useful for debugging and additional off-chain checks, such as verifying the
signature and the Merkle tree root.
**`formatForVerifierContract = (proof: SnarkProof, publicSignals: SnarkPublicSignals`**
**`formatForVerifierContract = (proof: SnarkProof, publicSignals: SnarkPublicSignals)`**
Converts the data in `proof` and `publicSignals` to strings and rearranges
elements of `proof.pi_b` so that `snarkjs`'s `verifier.sol` will accept it.

View File

@@ -26,7 +26,7 @@ With the Client contract as the owner of the Semaphore contract, the Client
contract may call owner-only Semaphore functions such as
`addExternalNullifier()`.
## Add, deactivate, or reactivate external nullifiiers
## Add, deactivate, or reactivate external nullifiers
These functions add, deactivate, and reactivate an external nullifier respectively.
As each identity can only signal once to an external nullifier, and as a signal

View File

@@ -55,7 +55,7 @@ In sum, Semaphore provides the ability to:
### External nullifiers
Think of an external nullifier as a voting booth where each user may only cast
one vote. If they try to cast a second vote a the same booth, that vote is
one vote. If they try to cast a second vote at the same booth, that vote is
invalid.
An external nullifier is any 29-byte value. Semaphore always starts with one
@@ -89,7 +89,7 @@ An anonymous voting app would be configured differently:
| ----------------------------------- | ------------------------ |
| The hash of the respondent's answer | The hash of the question |
This allows any user to vote with an arbitary response (e.g. yes, no, or maybe)
This allows any user to vote with an arbitrary response (e.g. yes, no, or maybe)
to any question. The user, however, can only vote once per question.
## About the code

View File

@@ -9,7 +9,7 @@ Site owners publish _subgraphs_ that expose site data for anyone to query.
Semaphore's subgraph allows you to retrieve data from the [`Semaphore.sol`](https://github.com/semaphore-protocol/semaphore/tree/v2.6.1/packages/contracts/Semaphore.sol) smart contract.
:::tip
The Graph protocol uses the [GraphQL](https://graphql.org/) query lanaguage. For examples, see the [GraphQL API documentation](https://thegraph.com/docs/developer/graphql-api). Visit the [subgraph repository](https://github.com/semaphore-protocol/subgraph) to see the list of Semaphore subgraphs.
The Graph protocol uses the [GraphQL](https://graphql.org/) query language. For examples, see the [GraphQL API documentation](https://thegraph.com/docs/developer/graphql-api). Visit the [subgraph repository](https://github.com/semaphore-protocol/subgraph) to see the list of Semaphore subgraphs.
:::
## Schema

View File

@@ -37,7 +37,7 @@ For more information, see [Merkle tree in Wikipedia](https://en.wikipedia.org/wi
## Nullifier
A value used to prevent double entry or double signalling.
A value used to prevent double entry or double signaling.
See [Circuit nullifier hash](/V3/technical-reference/circuits/#nullifier-hash).

View File

@@ -0,0 +1,135 @@
---
sidebar_position: 8
---
# Benchmarks
Semaphore v4 introduces new features and performance improvements. Detailed changes are available in the [release changelog](https://github.com/semaphore-protocol/semaphore/releases/tag/v4.0.0).
The primary changes in benchmark values are driven by the two major protocol updates:
- New [Identity schema](https://github.com/semaphore-protocol/semaphore/tree/main/packages/identity).
- [LeanIMT](https://github.com/privacy-scaling-explorations/zk-kit/tree/main/packages/lean-imt): New optimized IMT.
## New Identity schema
Semaphore v4 includes a new schema for the identities allowing the creation and verification of signatures.
Although the new Identity package is slightly slower than the one in Semaphore v3 (by just a few milliseconds), the trade-off is minimal considering the included functionality.
The new identity schema adds additional constraints to the Semaphore v4 circuit; however, this does not negatively impact overall performance of the protocol.
## LeanIMT
Semaphore v4 uses the LeanIMT data structure for group operations, an improvement over the IMT used in v3.
For further details, see the [LeanIMT paper](https://github.com/privacy-scaling-explorations/zk-kit/tree/main/papers/leanimt).
The LeanIMT offers dynamic depth, resulting in faster and more cost-effective group operations, across Node.js, browser and smart contracts.
Semaphore v4 support tree depths from 1 to 32, while v3 supports depths from 16 to 32, both for proof generation and verification.
## System Specifications and Software environment
All the benchmarks were run in an environment with these properties:
**System Specifications**
Computer: MacBook Pro
Chip: Apple M2 Pro
Memory (RAM): 16 GB
Operating System: macOS Sequoia version 15.6.1
**Software environment**
Node.js version: 23.10.0
Browser: Google Chrome Version 139.0.7258.156 (Official Build) (arm64)
## Running the benchmarks
### Javascript and Circom
GitHub repository to the run Node.js, browser and Circom benchmarks: https://github.com/vplasencia/semaphore-benchmarks
### Solidity
GitHub repository to run the Solidity benchmarks: https://github.com/semaphore-protocol/semaphore
Semaphore V3 benchmarks were obtained using the code from the latest v3 Git tag (`v3.15.2`), with the Solidity optimizer enabled.
## Node.js benchmarks
### Identities
![Identities](../../assets/img-benchmarks/node/identity-node-benchmarks.png)
### Create Group
Create group, either empty or with initial members.
![Create Group](../../assets/img-benchmarks/node/create-group-node-benchmarks.png)
### Add Member
Add a member to groups with different sizes.
![Add Member](../../assets/img-benchmarks/node/add-member-node-benchmarks.png)
### Generate Proof
Generate a proof using groups with different numbers of members.
![Generate Proof](../../assets/img-benchmarks/node/generate-proof-node-benchmarks.png)
### Verify Proof
Verify a proof using groups with different numbers of members.
![Verify Proof](../../assets/img-benchmarks/node/verify-proof-node-benchmarks.png)
## Browser benchmarks
Main functions used in the browser.
![Browser benchmarks](../../assets/img-benchmarks/browser/browser-benchmarks.png)
## Circuit benchmarks
Tree depth = 20
### Semaphore V3
<img
src={require('../../assets/img-benchmarks/circuits/semaphore-v3-circuits-benchmarks.png').default}
alt="Circuit benchmarks Semaphore v3"
style={{ width: '300px', height: 'auto' }}
/>
### Semaphore V4
<img
src={require('../../assets/img-benchmarks/circuits/semaphore-v4-circuits-benchmarks.png').default}
alt="Circuit benchmarks Semaphore v4"
style={{ width: '300px', height: 'auto' }}
/>
## Contracts
<img
src={require('../../assets/img-benchmarks/contracts/contract-benchmarks.png').default}
alt="Contract Benchmarks"
style={{ width: '560px', height: 'auto' }}
/>
### Semaphore V3 gas report
![Contracts benchmarks Semaphore v3](../../assets/img-benchmarks/contracts/semaphore-v3-contracts-benchmarks.png)
### Semaphore V4 gas report
![Contracts benchmarks Semaphore v4](../../assets/img-benchmarks/contracts/semaphore-v4-contracts-benchmarks.png)

View File

@@ -1,5 +1,5 @@
---
sidebar_position: 12
sidebar_position: 14
---
# Credits

View File

@@ -1,5 +1,5 @@
---
sidebar_position: 11
sidebar_position: 13
---
# FAQ

View File

@@ -118,7 +118,7 @@ In the project root folder:
2. Go to the `apps/contracts` folder and deploy your contract.
```bash
yarn deploy --semaphore <semaphore-address> --group <group-id> --network sepolia
yarn deploy --semaphore <semaphore-address> --network sepolia
```
:::note

View File

@@ -1,5 +1,5 @@
---
sidebar_position: 8
sidebar_position: 9
---
# Glossary
@@ -14,7 +14,7 @@ The public [Semaphore identity](#identity) value used in [Semaphore groups](#gro
## Group
A group is a [Merkle tree](#merkle-tree) in which each leaf is an [identity commitment](#identity-commitment) for a user. Semaphore uses the [LeanIMT](https://zkkit.pse.dev/classes/_zk_kit_imt.LeanIMT.html) implementation, which is an optimized binary incremental Merkle tree. The tree nodes are calculated using [Poseidon](https://www.poseidon-hash.info).
A group is a [Merkle tree](#merkle-tree) in which each leaf is an [identity commitment](#identity-commitment) for a user. Semaphore uses the [LeanIMT](https://zkkit.pse.dev/classes/_zk_kit_lean_imt.LeanIMT.html) implementation, which is an optimized binary incremental Merkle tree. The tree nodes are calculated using [Poseidon](https://www.poseidon-hash.info).
## Merkle tree

View File

@@ -20,7 +20,7 @@ To prevent fraud, the owner should keep their private key secret.
## Install package
In your code, use the [`@semaphore-protocol/identity`](https://github.com/semaphore-protocol/semaphore/tree/main/packages/identity) package to manage Semaphore identites.
In your code, use the [`@semaphore-protocol/identity`](https://github.com/semaphore-protocol/semaphore/tree/main/packages/identity) package to manage Semaphore identities.
<Tabs
defaultValue="npm"
@@ -87,6 +87,11 @@ You may choose to delegate such functionality to existing wallets such as Metama
3. The user can now recreate their Semaphore identity whenever they want by signing the same message with their Ethereum account in Metamask.
:::
:::warning Privacy risk
If a user signs the **same message** on multiple websites using MetaMask, all those websites will be able to **generate the same Semaphore identity**. This undermines anonymity and may allow third parties to **link identities across platforms** or even **gain control over a user's identity**.\
To mitigate this, encourage users to sign **unique messages per application** or implement safeguards that detect and warn about reuse.
:::
## Sign and verify messages
Semaphore V4 uses asymmetric cryptography and in particular EdDSA to generate the identity keys. It is therefore also possible to sign messages and verify their signatures.
@@ -109,3 +114,33 @@ After a message is signed, anyone can verify the signature using the message its
// Static method.
Identity.verifySignature(message, signature, identity1.publicKey)
```
## Export and import an identity
A Semaphore Identity can be exported and then imported later for reuse.
### Export an identity
Returns the private key encoded as a base64 string.
```ts
import { Identity } from "@semaphore-protocol/identity"
const identity = new Identity()
const privateKey = identity.export()
```
### Import an identity
Returns a Semaphore identity based on a private key encoded as a base64 string.
```ts
import { Identity } from "@semaphore-protocol/identity"
const identity = new Identity()
const privateKey = identity.export()
const identity2 = Identity.import(privateKey)
```

View File

@@ -79,7 +79,7 @@ const group = new Group(members)
Each proof requires a [scope](/glossary#scope), on which each user may only generate one valid proof. The scope, together with the user's private key, is used to generate the nullifier, which is the value you can actually use to check whether a proof with that scope has already been generated by that user. In a voting application where double-voting must be prevented, the scope could be the ballot id, or the Merkle root of the group.
### 4. Generate the anomymous message
### 4. Generate the anonymous message
Finally, you can generate the proof with the anonymous message using the `generateProof` function. For example:

View File

@@ -0,0 +1,55 @@
---
sidebar_position: 11
---
# Code editors and LLM setup
LLMs often rely on outdated or generic information. Use this guide to help set up your code editor to pull in more accurate, up-to-date documentation and examples. It will help provide better answers and generate more accurate Semaphore code using LLMs (large language models) and MCP (Model Context Protocol) servers.
## Quick use
[llms.txt](https://docs.semaphore.pse.dev/llms.txt) is a compact, text version of the Semaphore docs.
Add this link directly to your chat window for enhanced context.
## Permanent setup
Depending on your IDE, you can add custom docs to VS Code, Cursor or others.
Example for Cursor...
1. Press `CMD + Shift + P` (unix), `Ctrl + Shift + P` (Windows)
1. Type `Add new custom docs`.
1. Add https://docs.semaphore.pse.dev/llms.txt
1. In chat you can know `@docs` and choose `semaphore` to provide additional context.
Refer to the documentation of your IDE to properly set it up.
## MCP Server
Depending on your IDE, you can add a MCP server to communicate your docs to the AI model.
- [Context7 MCP server](https://github.com/upstash/context7) is a server that provides many libraries, incl. Semaphore.
Example for Cursor...
1. Press `CMD + Shift + J` (unix), `Ctrl + Shift + J` (Windows)
1. Click on `MCP` on the sidebar
1. Click `Add new global MCP server`
1. Add the following code to `mcp.json`
```
{
"mcpServers": {
"Context7": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
}
}
}
```
You can now prompt anything about Semaphore and write `use context7` at the end of your prompt. E.g. `create a new Semaphore identity in TypeScript. use context`. This will call the MCP tool and automatically fetch the latest documentation.
Refer to the documentation of your IDE to properly set it up.

View File

@@ -1,5 +1,5 @@
---
sidebar_position: 9
sidebar_position: 10
---
import Articles from '@site/src/components/Articles';

View File

@@ -1,5 +1,5 @@
---
sidebar_position: 10
sidebar_position: 12
---
import Tabs from "@theme/Tabs"

View File

@@ -11,6 +11,8 @@ slug: /
Additionally, it provides a simple mechanism to prevent double-signaling.
Use cases include private voting, whistleblowing, anonymous DAOs and mixers.
For in-depth technical details about Semaphore, refer to the [Semaphore V4 Specification](https://github.com/zkspecs/zkspecs/blob/main/specs/3/README.md).
## Features
With Semaphore, you can allow your users to do the following:
@@ -33,7 +35,7 @@ Semaphore is designed to be a simple and generic _privacy layer_ for decentraliz
## About the code
The core of the protocol is the [circuit logic](https://github.com/semaphore-protocol/semaphore/tree/main/packages/circuits/semaphore.circom).
The core of the protocol is the [circuit logic](https://github.com/semaphore-protocol/semaphore/tree/main/packages/circuits/src/semaphore.circom).
In addition to circuits,
Semaphore provides [Solidity contracts](https://github.com/semaphore-protocol/semaphore/tree/main/packages/contracts)
and [JavaScript libraries](https://github.com/semaphore-protocol/semaphore/tree/main#-packages) that allow developers to generate zero-knowledge proofs and verify them with minimal effort.

View File

@@ -42,21 +42,25 @@
## Networks
You can access any subgraph supported by Semaphore with the following URL: https://api.studio.thegraph.com/query/14377/semaphore-<network-name>/v4.0.0-beta.17.
You can access any subgraph supported by Semaphore with the following URL: `https://api.studio.thegraph.com/query/14377/semaphore-<network-name>/v4.5.0`.
Supported networks:
- `sepolia`
- `ethereum`
- `optimism`
- `optimism-sepolia`
- `arbitrum-one`
- `arbitrum`
- `arbitrum-sepolia`
- `matic`
- `polygon-amoy`
- `matic-amoy`
- `base-sepolia`
- `base`
- `linea-sepolia`
- `linea`
- `scroll-sepolia`
- `gnosis-chiado`
- `gnosis`
## 🛠 Install

View File

@@ -9,8 +9,8 @@
"codegen:sepolia": "yarn codegen sepolia",
"build": "graph build",
"build:sepolia": "yarn codegen:sepolia && graph build",
"auth": "graph auth --studio",
"deploy": "graph deploy --studio ${0}",
"auth": "graph auth",
"deploy": "graph deploy ${0}",
"start-ipfs": "node scripts/start-ipfs.js",
"create-local": "graph create --node http://localhost:8020/ semaphore",
"remove-local": "graph remove --node http://localhost:8020/ semaphore",
@@ -18,13 +18,13 @@
"test": "graph test Semaphore -v 0.5.0"
},
"dependencies": {
"@graphprotocol/graph-cli": "0.78.0",
"@graphprotocol/graph-ts": "0.35.1",
"@graphprotocol/graph-cli": "0.95.0",
"@graphprotocol/graph-ts": "0.37.0",
"@semaphore-protocol/utils": "workspace:packages/utils"
},
"devDependencies": {
"@types/mustache": "^4.2.2",
"matchstick-as": "0.5.0",
"@types/mustache": "^4.2.5",
"matchstick-as": "0.6.0",
"mustache": "^4.2.0"
}
}

View File

@@ -15,6 +15,10 @@ function mapNetwork(n) {
return "arbitrum-one"
}
if (n === "ethereum") {
return "mainnet"
}
return network
}

View File

@@ -26,7 +26,7 @@ export default function Build() {
url: "https://github.com/semaphore-protocol/boilerplate",
details: [
"Begin your projects with a ready-to-use example template",
"Create identity, join group, send anonmous feedback",
"Create identity, join group, send anonymous feedback",
"Easily modify to align with specific project goals"
]
},
@@ -133,7 +133,7 @@ export default function Build() {
</VStack>
</Flex>
<Box position="relative" w={{ base: "full", xl: "727px" }} h="630" overflow="hidden">
<Box position="relative" w={{ base: "full", xl: "727px" }} h="630px" overflow="hidden">
<Image
src="https://semaphore.cedoor.dev/flower-shadow.jpg"
alt=""

View File

@@ -40,6 +40,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
href="https://github.com/semaphore-protocol/semaphore/releases/tag/v4.0.0"
ml="1"
isExternal
color="primary.500"
>
<b>Semaphore V4</b>
</Link>{" "}

View File

@@ -131,7 +131,7 @@ export default function Home() {
>
1
</Heading>
<VStack align="left">
<VStack align="start">
<Text
fontSize={{ base: "18px", md: "20px" }}
fontFamily={sora.style.fontFamily}
@@ -152,7 +152,7 @@ export default function Home() {
>
3
</Heading>
<VStack align="left">
<VStack align="start">
<Text
fontSize={{ base: "18px", md: "20px" }}
fontFamily={sora.style.fontFamily}
@@ -181,7 +181,7 @@ export default function Home() {
>
2
</Heading>
<VStack align="left">
<VStack align="start">
<Text
fontSize={{ base: "18px", md: "20px" }}
fontFamily={sora.style.fontFamily}
@@ -203,7 +203,7 @@ export default function Home() {
>
4
</Heading>
<VStack align="left">
<VStack align="start">
<Text
fontSize={{ base: "18px", md: "20px" }}
fontFamily={sora.style.fontFamily}
@@ -225,7 +225,7 @@ export default function Home() {
<VStack mb="32" spacing="32">
<VStack w="full" maxW="1110px">
<Heading fontSize={{ base: "30px", md: "44px" }} pb="90px">
2024 Roadmap
2024-2025 Roadmap
</Heading>
<HStack display={{ base: "none", md: "flex" }} w="full" mt="60px">
@@ -287,10 +287,10 @@ export default function Home() {
Upcoming Events
</Heading>
<VStack align="left" spacing="10" maxH="600" overflowY="auto">
<VStack align="start" spacing="10" maxH="600px" overflowY="auto">
{events.map((event) => (
<Link href={event.link} key={event.name} isExternal>
<VStack align="left">
<VStack align="start">
<Heading fontSize={{ base: "20px", md: "24px" }}>
{event.date} | {event.name}
</Heading>

View File

@@ -5,7 +5,7 @@ import ProjectsList from "../../components/ProjectsList"
export default function Projects() {
return (
<>
<VStack pt="170px" pb="56px" w="100%" justify="end" align="left" spacing="40" position="relative">
<VStack pt="170px" pb="56px" w="100%" justify="end" align="start" spacing="40" position="relative">
<Box
zIndex="-1"
top="0"
@@ -25,7 +25,7 @@ export default function Projects() {
/>
</Box>
<VStack align="left" spacing="4" pb="16">
<VStack align="start" spacing="4" pb="16">
<Heading fontSize={{ base: "40px", sm: "46px", md: "72px" }}>Built with Semaphore</Heading>
<Text fontSize={{ base: "16px", sm: "18px", md: "20px" }}>
@@ -35,7 +35,7 @@ export default function Projects() {
</VStack>
</VStack>
<ProjectsList w="100%" align="left" pt="16" spacing="14" />
<ProjectsList w="100%" align="start" pt="16" spacing="14" />
<VStack my="128px">
<ActionCard

View File

@@ -46,7 +46,7 @@ export default function Carousel({ title, sizes, type, ...props }: CarouselProps
}, [index, size])
return (
<VStack align="left" w="full" spacing="16" {...props}>
<VStack align="start" w="full" spacing="16" {...props}>
<HStack justify={type === "projects" ? "center" : "space-between"}>
<Heading fontSize={{ base: "30px", md: "44px" }}>{title}</Heading>

View File

@@ -88,7 +88,7 @@ export default function Footer() {
</Link>
<Text fontSize={{ base: "12px", md: "14px" }} color="text.500" pt="2">
Copyright © 2024 Ethereum Foundation
Copyright © {new Date().getFullYear()} Ethereum Foundation
</Text>
</VStack>
</VStack>

View File

@@ -23,9 +23,9 @@ export default function InfoCard({ texts }: InfoCardProps) {
height={{ base: "auto", md: "474px" }}
>
<CardBody padding="0">
<VStack align="left" spacing="10" maxH="500" overflowY="auto">
<VStack align="start" spacing="10" maxH="500" overflowY="auto">
{texts.map((text) => (
<VStack key={text.title} align="left">
<VStack key={text.title} align="start">
<Heading textAlign="left" fontSize={{ base: "20px", md: "24px" }}>
{text.title}
</Heading>

View File

@@ -52,7 +52,7 @@ export default function ProjectsList(props: any) {
return (
<VStack {...props}>
<VStack align="left" spacing="6">
<VStack align="start" spacing="6">
<Text fontSize="20">Projects created by</Text>
<HStack spacing="4" flexWrap="wrap">
@@ -83,7 +83,7 @@ export default function ProjectsList(props: any) {
</HStack>
</VStack>
<VStack align="left" spacing="6" ref={viewToScrollRef}>
<VStack align="start" spacing="6" ref={viewToScrollRef}>
<Text fontSize="20">Category</Text>
<HStack spacing="3" flexWrap="wrap">
{getProjectCategories(sortedProjects).map((category) => (

View File

@@ -23,7 +23,7 @@ export default function SectionBlock({ title, description, linkText, linkUrl, co
return (
<VStack w="full">
<Flex flexDir={{ base: "column", lg: "row" }} gap="52px" w="full">
<VStack align="left" gap="32px" flex="1">
<VStack align="start" gap="32px" flex="1">
<Text fontSize={{ base: "40px", md: "44px" }} fontWeight={{ base: "400", md: "500" }}>
{title}
</Text>

View File

@@ -40,5 +40,19 @@
"date": "2024-01-01",
"authors": ["Vivek Bhupatiraju"],
"url": "https://vivs.wiki/Semaphore"
},
{
"title": "Getting Started with Semaphore: Building Privacy-Preserving dApps on Ethereum",
"minRead": 7,
"date": "2024-12-09",
"authors": ["glasswing"],
"url": "https://mirror.xyz/0xBE98D44c29D179588b7E717Db8898529e5cD770F/5Xlv1jzwJKfKgP-m257kjivBlUIM_cwTzsmpf9F0Su8"
},
{
"title": "Semaphore V4 Specification",
"minRead": 10,
"date": "2025-03-01",
"authors": ["Semaphore Team"],
"url": "https://github.com/zkspecs/zkspecs/blob/main/specs/3/README.md"
}
]

View File

@@ -1,14 +1,20 @@
[
{
"name": "DIF - Decentralized Identity Foundation",
"date": "Oct 1 - Nov 4, 2024",
"description": "Semaphore team will deliver a talk and sponsor prizes for the online hackathon.",
"link": "https://identity.foundation/"
"name": "ETHDam",
"date": "May 9-11, 2025",
"description": "Semaphore team will deliver an in-person talk.",
"link": "https://www.ethdam.com/"
},
{
"name": "Devcon",
"date": "Nov 12-15, 2024",
"name": "ZuBerlin",
"date": "June 14-22, 2025",
"description": "Semaphore team will deliver an in-person talk.",
"link": "https://zuberlin.city/"
},
{
"name": "Devconnect",
"date": "Nov 17-22, 2025",
"description": "Semaphore team will deliver an in-person talk and run workshops.",
"link": "https://devcon.org/en/"
"link": "https://devconnect.org/"
}
]

View File

@@ -555,5 +555,57 @@
"github": "https://github.com/GeneralMagicio/pairwise-RPGF4",
"website": "https://pairwise.vote"
}
},
{
"name": "VeilEscrow",
"categories": ["Privacy", "Coordination"],
"tagline": "Secure, private, and decentralized escrows for anonymous transactions",
"pse": false,
"icon": "",
"links": {
"github": "https://github.com/evgongora/VeilEscrow"
}
},
{
"name": "Obscurus",
"categories": ["Voting", "Privacy"],
"tagline": "An anonymity layer for Safe Wallet owners, built using Semaphore and Zodiac.",
"pse": false,
"icon": "",
"links": {
"github": "https://github.com/quartz-technology/obscurus"
}
},
{
"name": "Semaphore Modular Smart Account Modules",
"categories": ["Wallet", "Privacy"],
"tagline": "Anonymous multi-sig wallet with Semaphore",
"pse": false,
"icon": "",
"links": {
"github": "https://github.com/jimmychu0807/semaphore-msa-modules",
"website": "https://semaphore-msa-modules.jimmychu0807.hk"
}
},
{
"name": "Poll.cc",
"categories": ["Voting", "Social"],
"tagline": "Public online voting on social and political issues. Semaphore is used for anonymous voting while proving you're a real human verified by KYC.",
"pse": false,
"icon": "",
"links": {
"website": "https://poll.cc"
}
},
{
"name": "BringID",
"tagline": "Privacy-preserving proof of humanity using verifiable Internet credentials",
"categories": ["Identity", "Authenticity", "Trust"],
"pse": false,
"icon": "",
"links": {
"website": "https://www.bringid.org",
"github": "https://github.com/BringID/whitepaper"
}
}
]

View File

@@ -20,19 +20,31 @@
"done": true
},
{
"name": "Support more Testnets/Mainnets",
"name": "Support more Testnets & Mainnets",
"done": true
},
{
"name": "Documentation improvements",
"done": false
},
{
"name": "New Explorer",
"done": false
"done": true
},
{
"name": "RLN extension",
"name": "Semaphore V4 Specification",
"done": true
},
{
"name": "Semaphore Rust Implementation",
"done": true
},
{
"name": "Semaphore Noir Implementation",
"done": true
},
{
"name": "Scaling Semaphore with PIR",
"done": true
},
{
"name": "Maintenance",
"done": false
}
]

View File

@@ -118,5 +118,21 @@
"speakers": ["Vivian Plasencia"],
"url": "https://youtu.be/ux5Xy_lpiYk",
"thumbnail": "https://img.youtube.com/vi/ux5Xy_lpiYk/0.jpg"
},
{
"title": "Scaling Semaphore",
"eventName": "ETHDam",
"date": "2025-05-10",
"speakers": ["Vivian Plasencia"],
"url": "https://youtu.be/IkYtKSQLR-A",
"thumbnail": "https://img.youtube.com/vi/IkYtKSQLR-A/0.jpg"
},
{
"title": "Scaling Semaphore: Noir in Action",
"eventName": "NoirCon2",
"date": "2025-06-19",
"speakers": ["Vivian Plasencia"],
"url": "https://youtu.be/vfL7z74jGyU",
"thumbnail": "https://img.youtube.com/vi/vfL7z74jGyU/0.jpg"
}
]

View File

@@ -2,7 +2,7 @@
* This function takes an array and divides it into smaller arrays,
* or "chunks", each containing a specified number of elements.
* @param array The array to be split into chunks.
* @param size The size of each chunk. The default size is 10.
* @param size The size of each chunk. The default size is 15.
* @returns An array containing smaller subarrays (chunks), each with a length defined by the size.
*/
export function chunkArray(array: any[], size = 15): any[] {

View File

@@ -80,7 +80,7 @@
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"semver": "^7.6.2",
"snarkjs": "0.7.4",
"snarkjs": "0.7.5",
"ts-jest": "^29.1.2",
"ts-node": "^10.9.2",
"tslib": "^2.6.2",

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024 Ethereum Foundation
Copyright (c) 2025 Ethereum Foundation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,6 +1,6 @@
{
"name": "@semaphore-protocol/circuits",
"version": "4.4.1",
"version": "4.14.0",
"description": "Semaphore Circom circuits to generate zero-knowledge proofs.",
"license": "MIT",
"files": [
@@ -24,14 +24,14 @@
"access": "public"
},
"dependencies": {
"@zk-kit/binary-merkle-root.circom": "1.0.0",
"@zk-kit/binary-merkle-root.circom": "2.0.0",
"circomlib": "2.0.5"
},
"devDependencies": {
"@semaphore-protocol/core": "workspace:^",
"@types/mocha": "^10.0.6",
"@zk-kit/baby-jubjub": "1.0.3",
"circomkit": "0.0.19",
"circomkit": "0.3.3",
"mocha": "^10.2.0",
"poseidon-lite": "^0.3.0"
}

View File

@@ -27,7 +27,7 @@ template Semaphore(MAX_DEPTH) {
// See the Semaphore identity package to know more about how the identity is generated:
// https://github.com/semaphore-protocol/semaphore/tree/main/packages/identity.
signal input secret;
signal input merkleProofLength, merkleProofIndices[MAX_DEPTH], merkleProofSiblings[MAX_DEPTH];
signal input merkleProofLength, merkleProofIndex, merkleProofSiblings[MAX_DEPTH];
signal input message;
signal input scope;
@@ -56,9 +56,9 @@ template Semaphore(MAX_DEPTH) {
// Proof of membership verification.
// The Merkle root passed as output must be equal to that calculated within
// the circuit through the inputs of the Merkle proof.
// See https://github.com/privacy-scaling-explorations/zk-kit/blob/main/packages/circuits/circom/binary-merkle-root.circom
// See https://github.com/privacy-scaling-explorations/zk-kit.circom/blob/main/packages/binary-merkle-root/src/binary-merkle-root.circom
// to know more about how the 'BinaryMerkleRoot' template works.
merkleRoot <== BinaryMerkleRoot(MAX_DEPTH)(identityCommitment, merkleProofLength, merkleProofIndices, merkleProofSiblings);
merkleRoot <== BinaryMerkleRoot(MAX_DEPTH)(identityCommitment, merkleProofLength, merkleProofIndex, merkleProofSiblings);
// Nullifier generation.
// The nullifier is a value that essentially identifies the proof generated in a specific scope

View File

@@ -12,21 +12,18 @@ export const circomkit = new Circomkit({
})
export function generateMerkleProof(group: Group, _index: number, maxDepth: number) {
const { siblings: merkleProofSiblings, index } = group.generateMerkleProof(_index)
const { siblings: merkleProofSiblings, index: merkleProofIndex } = group.generateMerkleProof(_index)
// The index must be converted to a list of indices, 1 for each tree level.
// The circuit tree depth is 20, so the number of siblings must be 20, even if
// the tree depth is actually 3. The missing siblings can be set to 0, as they
// won't be used to calculate the root in the circuit.
const merkleProofIndices: number[] = []
// For example, if the circuit expects a Merkle tree of depth 20,
// the input must always include 20 sibling nodes, even if the actual
// tree depth is smaller (e.g., 3). The unused sibling positions can be
// filled with 0, as they won't affect the root calculation in the circuit.
for (let i = 0; i < maxDepth; i += 1) {
merkleProofIndices.push((index >> i) & 1)
if (merkleProofSiblings[i] === undefined) {
merkleProofSiblings[i] = BigInt(0)
}
}
return { merkleProofSiblings, merkleProofIndices }
return { merkleProofSiblings, merkleProofIndex }
}

View File

@@ -12,7 +12,7 @@ const r = 2188824287183927522224640574525727508854836440041603434369820418657580
describe("semaphore", () => {
let circuit: WitnessTester<
["secret", "merkleProofLength", "merkleProofIndices", "merkleProofSiblings", "scope", "message"],
["secret", "merkleProofLength", "merkleProofIndex", "merkleProofSiblings", "scope", "message"],
["nullifier", "merkleRoot"]
>
@@ -36,12 +36,12 @@ describe("semaphore", () => {
const group = new Group([commitment, 2n, 3n])
const { merkleProofSiblings, merkleProofIndices } = generateMerkleProof(group, 0, MAX_DEPTH)
const { merkleProofSiblings, merkleProofIndex } = generateMerkleProof(group, 0, MAX_DEPTH)
const INPUT = {
secret,
merkleProofLength: group.depth,
merkleProofIndices,
merkleProofIndex,
merkleProofSiblings,
scope,
message
@@ -61,12 +61,12 @@ describe("semaphore", () => {
const commitment = poseidon2(mulPointEscalar(Base8, secret))
const group = new Group([commitment, 2n, 3n])
const { merkleProofSiblings, merkleProofIndices } = generateMerkleProof(group, 0, MAX_DEPTH)
const { merkleProofSiblings, merkleProofIndex } = generateMerkleProof(group, 0, MAX_DEPTH)
const INPUT = {
secret,
merkleProofLength: group.depth,
merkleProofIndices,
merkleProofIndex,
merkleProofSiblings,
scope,
message
@@ -81,12 +81,12 @@ describe("semaphore", () => {
const commitment = poseidon2(mulPointEscalar(Base8, secret))
const group = new Group([commitment, 2n, 3n])
const { merkleProofSiblings, merkleProofIndices } = generateMerkleProof(group, 0, MAX_DEPTH)
const { merkleProofSiblings, merkleProofIndex } = generateMerkleProof(group, 0, MAX_DEPTH)
const INPUT = {
secret,
merkleProofLength: group.depth,
merkleProofIndices,
merkleProofIndex,
merkleProofSiblings,
scope,
message
@@ -100,12 +100,12 @@ describe("semaphore", () => {
const group = new Group([commitment, 2n, 3n])
const { merkleProofSiblings, merkleProofIndices } = generateMerkleProof(group, 0, MAX_DEPTH)
const { merkleProofSiblings, merkleProofIndex } = generateMerkleProof(group, 0, MAX_DEPTH)
const INPUT = {
secret,
merkleProofLength: group.depth,
merkleProofIndices,
merkleProofIndex,
merkleProofSiblings,
scope,
message

View File

@@ -0,0 +1,13 @@
#root = true
[*]
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 120
indent_size = 4
[*.md]
trim_trailing_whitespace = false

View File

@@ -0,0 +1,3 @@
SEPOLIA_RPC_URL=
PRIVATE_KEY=
ETHERSCAN_API_KEY=

View File

@@ -0,0 +1,43 @@
node_modules
.env
# solidity-coverage files
/coverage
/coverage.json
# Output of 'npm pack'
*.tgz
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Optional npm cache directory
.npm
.DS_Store
# yarn v3
.pnp.*
.pnp.js
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Foundry artifact
cache/
out/
# artifact for deploying on local Anvil node
**/31337

View File

@@ -0,0 +1,30 @@
# dependencies
node_modules
package-lock.json
yarn.lock
.yarn
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# testing
coverage
coverage.json
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Foundry artifact
cache/
out/
# artifact for deploying on local Anvil node
**/31337

View File

@@ -0,0 +1,6 @@
{
"semi": false,
"arrowParens": "always",
"trailingComma": "none",
"plugins": ["prettier-plugin-solidity"]
}

View File

@@ -0,0 +1,6 @@
{
"extends": "solhint:recommended",
"rules": {
"func-visibility": ["error", { "ignoreConstructors": true }]
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
compressionLevel: mixed
enableGlobalCache: false
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-4.1.0.cjs

View File

@@ -0,0 +1,113 @@
# Semaphore Foundry Template
This project demonstrates a basic Semaphore use case. It comes with a sample contract, a test for that contract and a sample script that deploys that contract.
## Prerequisites
This project requires [**Foundry**](https://getfoundry.sh/), and thus a [**Rust environment**](https://www.rust-lang.org/), installed in the machine.
## Install
### Install dependencies
```bash
yarn
```
## Usage
### Compile contracts
```bash
yarn compile
```
### Test contracts
```bash
yarn test
```
You can also generate a test coverage report:
```bash
yarn test:coverage
```
Or a test gas report:
```bash
yarn test:gas-report
```
You can also start a local [Anvil node](https://book.getfoundry.sh/anvil/) with Semaphore and Feedback contracts deployed on it with:
```bash
yarn dev
```
### Code quality and formatting
Run [solhint](https://github.com/protofire/solhint) to analyze the code and catch bugs:
```bash
yarn lint
```
Run [Prettier](https://prettier.io/) to check formatting rules:
```bash
yarn prettier
```
Or to automatically format the code:
```bash
yarn prettier:write
```
### Integrating with Semaphore Boilerplate
You can also integrate this project with [Semaphore Boilerplate](https://github.com/semaphore-protocol/boilerplate), using this project as the contract end and connecting with Boilerplate front end.
1. In `cli-template-contracts-foundry` package directory, run:
```sh
yarn install
yarn dev
```
After running `yarn dev`, notice the output of
```sh
# ...
# ...
== Return ==
feedbackAddr: address 0x6f1AFCA8BCA87bF02091AF6187a5002802f9FB31
semaphoreAddr: address 0xb730ce6CAE3FB706e83E4E00dFA31623966570eB
semaphoreVerifierAddr: address 0xE2c114f548bEf410eaCe04D0390b61cc963df295
# ...
# ...
```
2. Now, with another terminal, clone Semaphore Boilerplate down:
```sh
# Clone Semaphore boilerplate and build dependencies
git clone https://github.com/semaphore-protocol/boilerplate.git
cd boilerplate
yarn install
# Use the sample .env.example
cp .env.example .env
```
3. Open the file `apps/web-app/.env.development`. Modify the values of `NEXT_PUBLIC_FEEDBACK_CONTRACT_ADDRESS` and `NEXT_PUBLIC_SEMAPHORE_CONTRACT_ADDRESS` with **feedbackAddr** and **semaphoreAddr** values shown in step 1.
4. Run the Boilerplate front end:
```sh
yarn dev:web-app
```

View File

@@ -0,0 +1,15 @@
[profile.default]
src = "src"
out = "out"
script = "script"
libs = ["node_modules"]
allow_paths = ["*", "../.."]
[rpc_endpoints]
anvil = "http://127.0.0.1:8545"
# sepolia = "${SEPOLIA_RPC_URL}"
[etherscan]
# sepolia = { key = "${ETHERSCAN_API_KEY}" }
# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options

View File

@@ -0,0 +1,45 @@
{
"name": "@semaphore-protocol/cli-template-contracts-foundry",
"version": "4.14.0",
"description": "Semaphore Foundry template.",
"license": "Unlicense",
"devDependencies": {
"@semaphore-protocol/contracts": "4.14.0",
"@zk-kit/lean-imt.sol": "2.0.1",
"forge-std": "github:foundry-rs/forge-std#v1.9.4",
"poseidon-solidity": "0.0.5",
"prettier": "^3.2.5",
"prettier-plugin-solidity": "^1.3.1",
"solhint": "^4.1.1",
"wait-on": "^8.0.1"
},
"scripts": {
"dev": "anvil & (wait-on tcp:8545 && forge script script/DeployFeedback.s.sol --rpc-url anvil --broadcast --sender 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266)",
"compile": "forge build",
"clean": "forge clean",
"test": "forge test -vvv",
"test:report-gas": "forge test --gas-report",
"test:coverage": "forge coverage",
"lint": "yarn solhint \"{script,src,test}/**/*.sol\"",
"prettier": "prettier -c \"**/*.{json,md,svg,yml,sol}\"",
"prettier:write": "prettier -w \"**/*.{json,md,svg,yml,sol}\"",
"check": "yarn test & yarn lint & yarn prettier",
"prepublish": "tar -czf files.tgz .gitignore .yarn .yarnrc.yml"
},
"files": [
"src",
"test",
"script",
"package.json",
"foundry.toml",
"remappings.txt",
"README.md",
"files.tgz",
".editorconfig",
".env.example",
".prettierignore",
".prettierrc.json",
".solhint.json"
],
"packageManager": "yarn@4.1.0"
}

View File

@@ -0,0 +1,4 @@
@semaphore/contracts/=./node_modules/@semaphore-protocol/contracts/
@zk-kit/lean-imt.sol/=./node_modules/@zk-kit/lean-imt.sol/
forge-std/=./node_modules/forge-std/src/
poseidon-solidity/=./node_modules/poseidon-solidity/

View File

@@ -0,0 +1,37 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;
import {Feedback} from "../src/Feedback.sol";
import {Semaphore} from "@semaphore/contracts/Semaphore.sol";
import {SemaphoreVerifier} from "@semaphore/contracts/base/SemaphoreVerifier.sol";
import {ISemaphoreVerifier} from "@semaphore/contracts/interfaces/ISemaphoreVerifier.sol";
import {Script} from "forge-std/Script.sol";
// Passing SALT parameter to use CREATE2 for deterministic contract address
bytes32 constant SALT = bytes32(0);
contract DeployFeedback is Script {
function run() external returns (address feedbackAddr, address semaphoreAddr, address semaphoreVerifierAddr) {
// Default to use the first test user private key of anvil node
uint256 deployerPrivateKey = vm.envOr(
"PRIVATE_KEY",
uint256(0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80)
);
vm.startBroadcast(deployerPrivateKey);
// Deploy SemaphoreVerifier
SemaphoreVerifier semaphoreVerifierContract = new SemaphoreVerifier{salt: SALT}();
semaphoreVerifierAddr = address(semaphoreVerifierContract);
// Deploy Semaphore
Semaphore semaphoreContract = new Semaphore{salt: SALT}(ISemaphoreVerifier(semaphoreVerifierAddr));
semaphoreAddr = address(semaphoreContract);
// Deploy Feedback
Feedback feedbackContract = new Feedback{salt: SALT}(semaphoreAddr);
feedbackAddr = address(feedbackContract);
vm.stopBroadcast();
}
}

View File

@@ -0,0 +1,39 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;
import {ISemaphore} from "@semaphore/contracts/interfaces/ISemaphore.sol";
contract Feedback {
ISemaphore public semaphore;
uint256 public groupId;
constructor(address semaphoreAddress) {
semaphore = ISemaphore(semaphoreAddress);
groupId = semaphore.createGroup();
}
function joinGroup(uint256 identityCommitment) external {
semaphore.addMember(groupId, identityCommitment);
}
function sendFeedback(
uint256 merkleTreeDepth,
uint256 merkleTreeRoot,
uint256 nullifier,
uint256 feedback,
uint256[8] calldata points
) external {
ISemaphore.SemaphoreProof memory proof = ISemaphore.SemaphoreProof(
merkleTreeDepth,
merkleTreeRoot,
nullifier,
feedback,
groupId,
points
);
semaphore.validateProof(groupId, proof);
}
}

View File

@@ -0,0 +1,74 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;
import {Test} from "forge-std/Test.sol";
import {ISemaphore} from "@semaphore/contracts/interfaces/ISemaphore.sol";
import {ISemaphoreGroups} from "@semaphore/contracts/interfaces/ISemaphoreGroups.sol";
import {Feedback} from "../src/Feedback.sol";
import {DeployFeedback} from "../script/DeployFeedback.s.sol";
contract FeedbackTest is Test {
event MemberAdded(uint256 indexed groupId, uint256 index, uint256 identityCommitment, uint256 merkleTreeRoot);
Feedback internal feedbackContract;
ISemaphore internal semaphoreContract;
ISemaphoreGroups internal semaphoreGroups;
uint256 internal groupId;
function setUp() external {
DeployFeedback deployFeedback = new DeployFeedback();
(address feedbackAddress, address semaphoreAddress, ) = deployFeedback.run();
feedbackContract = Feedback(feedbackAddress);
semaphoreContract = ISemaphore(semaphoreAddress);
semaphoreGroups = ISemaphoreGroups(semaphoreAddress);
groupId = feedbackContract.groupId();
}
function testGroupCreatedInConstructor() public view {
uint256 groupCount = semaphoreContract.groupCounter();
assertEq(groupCount, 1);
}
function testJoinGroup() public {
// The commitment below is generated with private key of the first account in Anvil
uint256 identityCommitment = 15072455385723004728391568434269917452175057560864330595979104241296826134229;
// Test: expect an event emitted. Check for all event topics and data
vm.expectEmit(true, true, true, true);
emit MemberAdded(groupId, 0, identityCommitment, identityCommitment);
feedbackContract.joinGroup(identityCommitment);
}
function testSendFeedback() public {
uint256[] memory commitments = new uint256[](2);
commitments[0] = uint256(11005642493773047649202648265396872197147567800455247120861783398111750817516);
commitments[1] = uint256(14473821761500463903284857947161896352613497175238126022206384102438097355186);
for (uint256 i = 0; i < commitments.length; ++i) {
feedbackContract.joinGroup(commitments[i]);
}
uint256 merkleTreeDepth = 1;
uint256 merkleTreeRoot = semaphoreGroups.getMerkleTreeRoot(groupId);
uint256 feedback = uint256(bytes32("Hello World"));
// These values are computed by running through @semaphore-protocol/circuits
uint256 nullifier = 14622092170088252518938850323258916742048811914834592843410744760450844885096;
uint256[8] memory points = [
2004484873491928515306456072357737929124240734208600886081152392890959117520,
21291026142870585364296731900941597996672838511394659364623185352043543529323,
4657264777014371046112557309523098953851041383509685591373847255581509612788,
6904165961903336246592681066375875983213983935764940579845010085396463328555,
1952750241178995674697344628236393389729638396609772141225880353616301956443,
106937615136633409337870509099767689510837462832227699340906789167349502398,
13080722838047436988558418790480431472161933638137155324683844808531903905810,
2547578906197450986657523555784319153413167960139250957065929818900731634820
];
vm.expectEmit(true, true, true, true);
emit ISemaphore.ProofValidated(groupId, merkleTreeDepth, merkleTreeRoot, nullifier, feedback, groupId, points);
feedbackContract.sendFeedback(merkleTreeDepth, merkleTreeRoot, nullifier, feedback, points);
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@semaphore-protocol/cli-template-contracts-hardhat",
"version": "4.4.1",
"version": "4.14.0",
"description": "Semaphore Hardhat template.",
"license": "Unlicense",
"files": [
@@ -16,7 +16,8 @@
".prettierrc.json",
"hardhat.config.ts",
"tsconfig.json",
"README.md"
"README.md",
".solhint.json"
],
"publishConfig": {
"access": "public"
@@ -41,9 +42,9 @@
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
"@nomicfoundation/hardhat-toolbox": "^4.0.0",
"@nomicfoundation/hardhat-verify": "^2.0.0",
"@semaphore-protocol/core": "4.4.1",
"@semaphore-protocol/hardhat": "4.4.1",
"@semaphore-protocol/utils": "4.4.1",
"@semaphore-protocol/core": "4.14.0",
"@semaphore-protocol/hardhat": "4.14.0",
"@semaphore-protocol/utils": "4.14.0",
"@typechain/ethers-v6": "^0.5.0",
"@typechain/hardhat": "^9.0.0",
"@types/chai": "^4.2.0",
@@ -59,7 +60,7 @@
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"ethers": "^6.4.0",
"ethers": "^6.13.4",
"hardhat": "^2.20.1",
"hardhat-gas-reporter": "^1.0.8",
"prettier": "^3.2.5",
@@ -71,7 +72,7 @@
"typescript": "^5.3.3"
},
"dependencies": {
"@semaphore-protocol/contracts": "4.4.1"
"@semaphore-protocol/contracts": "4.14.0"
},
"packageManager": "yarn@4.1.0"
}

View File

@@ -20,9 +20,9 @@
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
"@nomicfoundation/hardhat-toolbox": "^4.0.0",
"@nomicfoundation/hardhat-verify": "^2.0.0",
"@semaphore-protocol/core": "4.4.1",
"@semaphore-protocol/hardhat": "4.4.1",
"@semaphore-protocol/utils": "4.4.1",
"@semaphore-protocol/core": "4.14.0",
"@semaphore-protocol/hardhat": "4.14.0",
"@semaphore-protocol/utils": "4.14.0",
"@typechain/ethers-v6": "^0.5.0",
"@typechain/hardhat": "^9.0.0",
"@types/chai": "^4.2.0",
@@ -38,7 +38,7 @@
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"ethers": "^6.4.0",
"ethers": "^6.13.4",
"hardhat": "^2.20.1",
"hardhat-gas-reporter": "^1.0.8",
"prettier": "^3.2.5",
@@ -50,7 +50,7 @@
"typescript": "^5.3.3"
},
"dependencies": {
"@semaphore-protocol/contracts": "4.4.1"
"@semaphore-protocol/contracts": "4.14.0"
},
"packageManager": "yarn@4.1.0"
}

View File

@@ -9,10 +9,10 @@
"lint": "next lint"
},
"dependencies": {
"@semaphore-protocol/core": "4.4.1",
"@semaphore-protocol/data": "4.4.1",
"@semaphore-protocol/utils": "4.4.1",
"ethers": "^6.11.1",
"@semaphore-protocol/core": "4.14.0",
"@semaphore-protocol/data": "4.14.0",
"@semaphore-protocol/utils": "4.14.0",
"ethers": "^6.13.4",
"next": "14.1.0",
"next-pwa": "^5.6.0",
"react": "^18",

View File

@@ -114,7 +114,7 @@ export default function GroupsPage() {
</a>{" "}
are{" "}
<a
href="https://zkkit.pse.dev/classes/_zk_kit_imt.LeanIMT.html"
href="https://zkkit.pse.dev/classes/_zk_kit_lean_imt.LeanIMT.html"
target="_blank"
rel="noreferrer noopener nofollow"
>

View File

@@ -1,6 +1,6 @@
{
"name": "@semaphore-protocol/cli-template-monorepo-ethers",
"version": "4.4.1",
"version": "4.14.0",
"description": "Semaphore Hardhat + Next.js + SemaphoreEthers template.",
"license": "Unlicense",
"files": [

View File

@@ -20,9 +20,9 @@
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
"@nomicfoundation/hardhat-toolbox": "^4.0.0",
"@nomicfoundation/hardhat-verify": "^2.0.0",
"@semaphore-protocol/core": "4.4.1",
"@semaphore-protocol/hardhat": "4.4.1",
"@semaphore-protocol/utils": "4.4.1",
"@semaphore-protocol/core": "4.14.0",
"@semaphore-protocol/hardhat": "4.14.0",
"@semaphore-protocol/utils": "4.14.0",
"@typechain/ethers-v6": "^0.5.0",
"@typechain/hardhat": "^9.0.0",
"@types/chai": "^4.2.0",
@@ -38,7 +38,7 @@
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"ethers": "^6.4.0",
"ethers": "^6.13.4",
"hardhat": "^2.20.1",
"hardhat-gas-reporter": "^1.0.8",
"prettier": "^3.2.5",
@@ -50,7 +50,7 @@
"typescript": "^5.3.3"
},
"dependencies": {
"@semaphore-protocol/contracts": "4.4.1"
"@semaphore-protocol/contracts": "4.14.0"
},
"packageManager": "yarn@4.1.0"
}

View File

@@ -9,10 +9,10 @@
"lint": "next lint"
},
"dependencies": {
"@semaphore-protocol/core": "4.4.1",
"@semaphore-protocol/data": "4.4.1",
"@semaphore-protocol/utils": "4.4.1",
"ethers": "^6.11.1",
"@semaphore-protocol/core": "4.14.0",
"@semaphore-protocol/data": "4.14.0",
"@semaphore-protocol/utils": "4.14.0",
"ethers": "^6.13.4",
"next": "14.1.0",
"next-pwa": "^5.6.0",
"react": "^18",

View File

@@ -114,7 +114,7 @@ export default function GroupsPage() {
</a>{" "}
are{" "}
<a
href="https://zkkit.pse.dev/classes/_zk_kit_imt.LeanIMT.html"
href="https://zkkit.pse.dev/classes/_zk_kit_lean_imt.LeanIMT.html"
target="_blank"
rel="noreferrer noopener nofollow"
>

View File

@@ -90,7 +90,7 @@ export default function GroupsPage() {
</a>{" "}
are{" "}
<a
href="https://zkkit.pse.dev/classes/_zk_kit_imt.LeanIMT.html"
href="https://zkkit.pse.dev/classes/_zk_kit_lean_imt.LeanIMT.html"
target="_blank"
rel="noreferrer noopener nofollow"
>

View File

@@ -1,6 +1,6 @@
{
"name": "@semaphore-protocol/cli-template-monorepo-subgraph",
"version": "4.4.1",
"version": "4.14.0",
"description": "Semaphore Hardhat + Next.js + SemaphoreSubgraph template.",
"license": "Unlicense",
"files": [

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024 Ethereum Foundation
Copyright (c) 2025 Ethereum Foundation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,7 @@
{
"name": "@semaphore-protocol/cli",
"type": "module",
"version": "4.4.1",
"version": "4.14.0",
"description": "A command line tool to set up your Semaphore project and get group data.",
"license": "MIT",
"bin": {
@@ -41,8 +41,8 @@
"rollup-plugin-cleanup": "^3.2.1"
},
"dependencies": {
"@semaphore-protocol/data": "4.4.1",
"@semaphore-protocol/utils": "4.4.1",
"@semaphore-protocol/data": "4.14.0",
"@semaphore-protocol/utils": "4.14.0",
"axios": "^1.6.7",
"boxen": "^7.1.1",
"chalk": "^5.3.0",

View File

@@ -13,6 +13,7 @@ import checkLatestVersion from "./checkLatestVersion.js"
import getGroupIds from "./getGroupIds.js"
import { getGroupId, getProjectName, getSupportedNetwork, getSupportedTemplate } from "./inquirerPrompts.js"
import Spinner from "./spinner.js"
import removePrePublishScript from "./removePrePublishScript.js"
// Define the path to the package.json file to extract metadata for the CLI.
const packagePath = `${dirname(fileURLToPath(import.meta.url))}/..`
@@ -31,6 +32,10 @@ const supportedTemplates = [
{
value: "contracts-hardhat",
name: "Hardhat"
},
{
value: "contracts-foundry",
name: "Foundry"
}
]
@@ -103,6 +108,12 @@ program
// Create an empty yarn.lock file to install dependencies successfully
writeFileSync(`${currentDirectory}/${projectDirectory}/yarn.lock`, "")
// Read and modify package.json to remove prepublish script
const packageJsonPath = `${currentDirectory}/${projectDirectory}/package.json`
const packageJsonContent = readFileSync(packageJsonPath, "utf8")
const updatedPackageJsonContent = removePrePublishScript(packageJsonContent)
writeFileSync(packageJsonPath, updatedPackageJsonContent)
spinner.stop()
console.info(`\n ${logSymbols.success}`, `Your project is ready!\n`)
@@ -111,7 +122,7 @@ program
console.info(` ${chalk.cyan("yarn install")}\n`)
// Read the package.json to list available npm scripts.
const { scripts } = JSON.parse(readFileSync(`${currentDirectory}/${projectDirectory}/package.json`, "utf8"))
const { scripts } = JSON.parse(updatedPackageJsonContent)
if (scripts) {
console.info(` Available scripts:\n`)

View File

@@ -0,0 +1,16 @@
// Remove the prepublish script from the package.json file when creating a new project using the Semaphore CLI.
export default function removePrePublishScript(packageJsonContent: string): string {
try {
const packageJson = JSON.parse(packageJsonContent)
if (packageJson.scripts && "prepublish" in packageJson.scripts) {
delete packageJson.scripts.prepublish
if (Object.keys(packageJson.scripts).length === 0) {
delete packageJson.scripts
}
}
return JSON.stringify(packageJson, null, 2)
} catch (error) {
console.error("Error processing package.json:", error)
return packageJsonContent
}
}

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024 Ethereum Foundation
Copyright (c) 2025 Ethereum Foundation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -46,18 +46,16 @@ To learn more about contracts visit [semaphore.pse.dev](https://docs.semaphore.p
## 🛠 Install
### npm or yarn
You can install the semaphore protocol contracts with any node package manager (`bun`, `npm`, `pnpm`,`yarn`) or the solidity package manager [`soldeer`](https://soldeer.xyz).
Install the `@semaphore-protocol/contracts` package with npm:
```bash
```commandline
bun add @semaphore-protocol/contracts
npm i @semaphore-protocol/contracts
```
or yarn:
```bash
pnpm add @semaphore-protocol/contracts
yarn add @semaphore-protocol/contracts
# for soldeer, an explicit version is required, e.g:
soldeer install semaphore-protocol-contracts~4.6.0
```
## 📜 Usage

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;
pragma solidity >=0.8.23 <0.9.0;
import {ISemaphore} from "./interfaces/ISemaphore.sol";
import {ISemaphoreVerifier} from "./interfaces/ISemaphoreVerifier.sol";

Some files were not shown because too many files have changed in this diff Show More