Skip to content

Commit

Permalink
Merge pull request #493 from semaphore-protocol/chore/landing
Browse files Browse the repository at this point in the history
Adapt Semaphore documentation to new Identity Kit
  • Loading branch information
cedoor authored Dec 20, 2023
2 parents c710a46 + 65850a5 commit b4542a5
Show file tree
Hide file tree
Showing 73 changed files with 180 additions and 1,254 deletions.
12 changes: 3 additions & 9 deletions apps/docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const darkCodeTheme = require("prism-react-renderer/themes/dracula")
module.exports = {
title: "Semaphore",
tagline: "Documentation and Guides",
url: "https://semaphore.pse.dev/",
url: "https://docs.semaphore.pse.dev/",
baseUrl: "/",
favicon: "/img/favicon.ico",
onBrokenLinks: "throw",
Expand All @@ -30,7 +30,7 @@ module.exports = {
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
routeBasePath: "docs/",
routeBasePath: "/",
sidebarPath: require.resolve("./sidebars.js"),
editUrl: "https://github.com/semaphore-protocol/website/edit/main/",
includeCurrentVersion: false
Expand Down Expand Up @@ -60,16 +60,10 @@ module.exports = {
items: [
{
label: "Whitepaper",
to: "https://semaphore.pse.dev/whitepaper-v1.pdf",
to: "https://docs.semaphore.pse.dev/whitepaper-v1.pdf",
position: "right",
className: "V1"
},
{
label: "Documentation",
href: "/docs/introduction",
position: "right",
className: "homepage"
},
{
label: "Github",
href: "https://github.com/semaphore-protocol",
Expand Down
9 changes: 0 additions & 9 deletions apps/docs/i18n/en/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,6 @@
"footer.left.description": {
"message": "Semaphore is part of Privacy & Scaling Explorations (PSE), a multidisciplinary team supported by the Ethereum Foundation. PSE explores new use cases for zero knowledge proofs and other cryptographic primitives."
},
"footer.right.usedby.title": {
"message": "Used by"
},
"footer.right.usedby.link1": {
"message": "Unirep"
},
"footer.right.usedby.link2": {
"message": "Interep"
},
"footer.right.learn.title": {
"message": "Learn"
},
Expand Down
9 changes: 0 additions & 9 deletions apps/docs/i18n/es/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,6 @@
"footer.left.description": {
"message": "Semaphore es parte de Privacy & Scaling Explorations (PSE), un equipo multidisciplinario apoyado por la Fundación Ethereum. PSE explora nuevos casos de uso para pruebas de conocimiento cero (ZKPs) y otras bases criptográficas."
},
"footer.right.usedby.title": {
"message": "Utilizado en"
},
"footer.right.usedby.link1": {
"message": "Unirep"
},
"footer.right.usedby.link2": {
"message": "Interep"
},
"footer.right.learn.title": {
"message": "Aprender"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
id: introduction
title: What Is Semaphore?
sidebar_position: 1
slug: /
---

## Overview
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ For more information, see [Merkle tree in Wikipedia](https://en.wikipedia.org/wi

A value used to prevent double entry or double signalling.

See [Circuit nullifier hash](/docs/technical-reference/circuits/#nullifier-hash).
See [Circuit nullifier hash](/technical-reference/circuits/#nullifier-hash).

## Relay

A third-party who receives a fee for including relayed transactions in the blockchain (McMenamin, Daza, and Fitz. https://eprint.iacr.org/2022/155.pdf, p.3).
To preserve the anonymity of the user broadcasting a signal with Semaphore, an application may use a relayer to post the signal transaction to Ethereum on behalf of the user.

Applications may provide rewards for relayers and implement front-running prevention mechanisms, such as requiring the signals to include the relayer’s address, binding the
signal to that specific address (https://semaphore.pse.dev/whitepaper-v1.pdf, p.6).
signal to that specific address (https://docs.semaphore.pse.dev/whitepaper-v1.pdf, p.6).

## Trusted setup files

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ title: Groups

Use Semaphore in your application or smart contract to create off-chain and on-chain groups.

A [Semaphore group](/docs/glossary/#semaphore-group) contains [identity commitments](/docs/glossary/#identity-commitment) of group members.
A [Semaphore group](/glossary/#semaphore-group) contains [identity commitments](/glossary/#identity-commitment) of group members.
Example uses of groups include the following:

- Poll question that attendees join to rate an event.
- Ballot that members join to vote on a proposal.
- Whistleblowers who are verified employees of an organization.

A Semaphore group is an [incremental Merkle tree](/docs/glossary/#incremental-merkle-tree), and group members (i.e., [identity commitments](/docs/glossary/#identity-commitments)) are tree leaves.
A Semaphore group is an [incremental Merkle tree](/glossary/#incremental-merkle-tree), and group members (i.e., [identity commitments](/glossary/#identity-commitments)) are tree leaves.
Semaphore groups set the following two parameters:

- **Tree depth**: the maximum number of members a group can contain (`max size = 2 ^ tree depth`).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: Identities

# Semaphore identities

In order to join a [Semaphore group](/docs/glossary#semaphore-group), a user must first create a [Semaphore identity](/docs/glossary#semaphore-identity).
In order to join a [Semaphore group](/glossary#semaphore-group), a user must first create a [Semaphore identity](/glossary#semaphore-identity).
A Semaphore identity contains two values generated with the identity:

- Identity trapdoor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: Proofs

Learn how to use Semaphore to generate and verify zero-knowledge proofs.

Once a user joins their [Semaphore identity](/docs/glossary#semaphore-identity) to a [Semaphore group](/docs/glossary#semaphore-group), the user can signal anonymously with a zero-knowledge proof that proves the following:
Once a user joins their [Semaphore identity](/glossary#semaphore-identity) to a [Semaphore group](/glossary#semaphore-group), the user can signal anonymously with a zero-knowledge proof that proves the following:

- The user is a member of the group.
- The same user created the signal and the proof.
Expand All @@ -27,11 +27,11 @@ To generate a proof, pass the following properties to the `generateProof` functi
- `group`: The group to which the user belongs.
- `externalNullifier`: The value that prevents double-signaling.
- `signal`: The signal the user wants to send anonymously.
- `snarkArtifacts`: The `zkey` and `wasm` [trusted setup files](/docs/glossary/#trusted-setup-files).
- `snarkArtifacts`: The `zkey` and `wasm` [trusted setup files](/glossary/#trusted-setup-files).

In the voting system use case, once all the voters have joined their [identities](/docs/guides/identities#create-an-identity) to the ballot [group](/docs/guides/groups),
In the voting system use case, once all the voters have joined their [identities](/guides/identities#create-an-identity) to the ballot [group](/guides/groups),
a voter can generate a proof to vote for a proposal.
In the call to `generateProof`, the voting system passes the unique ballot ID (the [Merkle tree](/docs/glossary/#merkle-tree/) root of the group) as the
In the call to `generateProof`, the voting system passes the unique ballot ID (the [Merkle tree](/glossary/#merkle-tree/) root of the group) as the
`externalNullifier` to prevent the voter signaling more than once for the ballot.
The following code sample shows how to use `generateProof` to generate the voting proof:

Expand All @@ -53,7 +53,7 @@ Use the [`@semaphore-protocol/proof`](https://github.com/semaphore-protocol/sema
To verify a proof, pass the following to the `verifyProof` function:

- _`proof`_: the Semaphore proof.
- _`verificationKey`_: the JavaScript object in the `semaphore.json` [trusted setup file](/docs/glossary/#trusted-setup-files).
- _`verificationKey`_: the JavaScript object in the `semaphore.json` [trusted setup file](/glossary/#trusted-setup-files).

The following code sample shows how to parse the verification key object from `semaphore.json`
and verify the previously generated proof:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ To install these dependencies for your project, do the following:
yarn add @semaphore-protocol/identity@2.6.1 @semaphore-protocol/group@2.6.1 @semaphore-protocol/proof@2.6.1 @semaphore-protocol/hardhat@0.1.0 --dev
```

For more detail about _Semaphore contracts_, see [Contracts](https://semaphore.pse.dev/docs/technical-reference/contracts).
For more detail about _Semaphore contracts_, see [Contracts](https://docs.semaphore.pse.dev/technical-reference/contracts).
To view the source of our packages, see the [semaphore](https://github.com/semaphore-protocol/semaphore/tree/v2.6.1#-packages) repository.

## Create the Semaphore contract
Expand Down Expand Up @@ -213,7 +213,7 @@ and [Chai assertions](https://www.chaijs.com/).
wget http://www.trusted-setup-pse.org/semaphore/20/semaphore.wasm
```
Learn more about [trusted setup files](/docs/glossary/#trusted-setup-files).
Learn more about [trusted setup files](/glossary/#trusted-setup-files).
3. Rename the `Lock.js` test file to `Greeter.js` and replace the content with the following:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ sidebar_position: 2

The [Semaphore circuit](https://github.com/semaphore-protocol/semaphore/tree/v2.6.1/packages/circuits) is the heart of the protocol and consists of three parts:

- [**Proof of membership**](/docs/technical-reference/circuits#proof-of-membership)
- [**Nullifier hash**](/docs/technical-reference/circuits#nullifier-hash)
- [**Signal**](/docs/technical-reference/circuits#signal)
- [**Proof of membership**](/technical-reference/circuits#proof-of-membership)
- [**Nullifier hash**](/technical-reference/circuits#nullifier-hash)
- [**Signal**](/technical-reference/circuits#signal)

![Semaphore circuit](https://github.com/semaphore-protocol/semaphore/raw/v2.6.1/packages/circuits/scheme.png)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ sidebar_position: 3

Semaphore includes three types of contracts:

- [**Base contracts**](/docs/technical-reference/contracts#base-contracts)
- [**Extension contracts**](/docs/technical-reference/contracts#extension-contracts)
- [**Verifiers**](/docs/technical-reference/contracts#verifiers)
- [**Base contracts**](/technical-reference/contracts#base-contracts)
- [**Extension contracts**](/technical-reference/contracts#extension-contracts)
- [**Verifiers**](/technical-reference/contracts#verifiers)

:::info
To use Semaphore contracts and interfaces in your project,
Expand All @@ -24,7 +24,7 @@ Semaphore provides the following base contracts:

These contracts are closely related to the protocol.
You can inherit them in your contract or you can use [`Semaphore.sol`](https://github.com/semaphore-protocol/semaphore/tree/v2.6.1/packages/contracts/Semaphore.sol), which inherits them for you.
See our [deployed contracts](/docs/deployed-contracts#semaphore) to find the addresses for your network.
See our [deployed contracts](/deployed-contracts#semaphore) to find the addresses for your network.

:::info
While some dApps may use on-chain groups, others may prefer to use off-chain groups, saving only their tree roots in the contract.
Expand All @@ -41,10 +41,10 @@ More extensions will be added in the future.
## Verifiers

To verify Semaphore proofs, the [`SemaphoreCore.sol`](https://github.com/semaphore-protocol/semaphore/tree/v2.6.1/packages/contracts/base/SemaphoreCore.sol) contract requires the address of a deployed verifier contract.
You can choose to manually deploy the [verifier](https://github.com/semaphore-protocol/semaphore/tree/v2.6.1/packages/contracts/verifiers) you prefer or you can use one of our [deployed verifiers](/docs/deployed-contracts#verifiers).
You can choose to manually deploy the [verifier](https://github.com/semaphore-protocol/semaphore/tree/v2.6.1/packages/contracts/verifiers) you prefer or you can use one of our [deployed verifiers](/deployed-contracts#verifiers).

Each verifier name indicates the tree depth that it can verify.
For example, given a Semaphore proof generated with a tree depth `20`:

- The `Verifier20.sol` contract can verify the proof.
- The [group](/docs/guides/groups) used for the proof can have a maximum `2^20=1048576` members.
- The [group](/guides/groups) used for the proof can have a maximum `2^20=1048576` members.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Community members connect their wallets to the dApp to take the following action

### Relay

To preserve anonymity and avoid disclosing the member's wallet address, the dApp may use a [relay](/docs/glossary/#relay) to broadcast the vote.
To preserve anonymity and avoid disclosing the member's wallet address, the dApp may use a [relay](/glossary/#relay) to broadcast the vote.
The relay calls the **contract** function that then posts the member's vote transaction to Ethereum.

## Private voting
Expand All @@ -52,7 +52,7 @@ The voting scenario has the following steps:

### Create a poll

A community coordinator or dApp administrator uses the deployed smart contract to create an on-chain (Ethereum) poll, a [Semaphore group](/docs/guides/groups/) that members can join and cast votes to.
A community coordinator or dApp administrator uses the deployed smart contract to create an on-chain (Ethereum) poll, a [Semaphore group](/guides/groups/) that members can join and cast votes to.

In the following sample code, the voting contract declares a `createPoll` function that uses the Semaphore base `_createGroup` function:

Expand All @@ -78,11 +78,11 @@ function createPoll(
}
```

A poll is a Semaphore [group](/docs/guides/groups/) that stores the following:
A poll is a Semaphore [group](/guides/groups/) that stores the following:

- A topic to vote on.
- The public ID of the poll creator.
- [Semaphore IDs](/docs/guides/identities/) of members who joined the poll.
- [Semaphore IDs](/guides/identities/) of members who joined the poll.

To create the poll, the administrator calls the smart contract function--for example:

Expand Down Expand Up @@ -128,10 +128,10 @@ With a member registered for a poll, learn how the dApp [records votes](#record-
Once members have joined a poll, the coordinator starts the poll to allow voting.
When a member votes (for example, by selecting a radio button), then the dApp takes the following actions:

1. Uses the `@semaphore-protocol/proof` library to create a proof of the vote, the poll identifier, the Semaphore ID, and a [nullifier](/docs/glossary/#nullifier) that prevents double-voting.
1. Uses the `@semaphore-protocol/proof` library to create a proof of the vote, the poll identifier, the Semaphore ID, and a [nullifier](/glossary/#nullifier) that prevents double-voting.
2. Sends the vote proof to the [relay](#relay).

### Related

- To get started developing with Semaphore, see the [Quick setup](/docs/quick-setup/) guide.
- To get started developing with Semaphore, see the [Quick setup](/quick-setup/) guide.
- For an example app that you can use to start your own project, see [Semaphore boilerplate](https://github.com/semaphore-protocol/boilerplate).
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
id: introduction
title: What Is Semaphore?
sidebar_position: 1
slug: /
---

## Overview
Expand All @@ -14,9 +15,9 @@ Use cases include private voting, whistleblowing, anonymous DAOs and mixers.

With Semaphore, you can allow your users to do the following:

1. [Create a Semaphore identity](/docs/guides/identities/).
2. [Add their Semaphore identity to a group (i.e. _Merkle tree_)](/docs/guides/groups/).
3. [Send a verifiable, anonymous signal (e.g a vote or endorsement)](/docs/guides/proofs/).
1. [Create a Semaphore identity](/guides/identities/).
2. [Add their Semaphore identity to a group (i.e. _Merkle tree_)](/guides/groups/).
3. [Send a verifiable, anonymous signal (e.g a vote or endorsement)](/guides/proofs/).

When a user broadcasts a signal (for example: a vote), Semaphore zero-knowledge
proofs can ensure that the user has joined the group and hasn't already cast a signal with their nullifier.
Expand Down Expand Up @@ -45,5 +46,5 @@ and [JavaScript libraries](https://github.com/semaphore-protocol/semaphore/tree/
| v2.5.0 | [Semaphore_2.5.0_Audit.pdf](https://github.com/semaphore-protocol/semaphore/files/9845008/Semaphore_2.5.0_Audit.pdf) | `contracts`, `libraries` |

:::info
If you are using the previous version of Semaphore, see the [Semaphore V1](/docs/V1/introduction) documentation.
If you are using the previous version of Semaphore, see the [Semaphore V1](/V1) documentation.
:::
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Finalmente, el nullifier hash (hash del anulador) es solo el hash del identity n

En el caso de una aplicación de votación, si tiene un grupo y desea que todos los miembros de este grupo voten solo una vez, puede usar la identificación del grupo como external nullifier. Cuando un usuario vota por primera vez, puede guardar el hash de su identity nullifier y la identificación del grupo (es decir, el nullifier hash) y evitar la doble votación comprobando si ese hash ya existe.

Vea los [circuitos de Semaphore](https://semaphore.pse.dev/docs/technical-reference/circuits) para más información técnica, o el [Semaphore boilerplate](https://github.com/semaphore-protocol/boilerplate) para un caso de uso real.
Vea los [circuitos de Semaphore](https://docs.semaphore.pse.dev/technical-reference/circuits) para más información técnica, o el [Semaphore boilerplate](https://github.com/semaphore-protocol/boilerplate) para un caso de uso real.

## ¿Por qué debo evitar que las pruebas se verifiquen dos veces?

Expand All @@ -48,7 +48,7 @@ Hay tres formas de comenzar a usar Semaphore en su proyecto: usando la [Semaphor

### Semaphore CLI

Para crear un nuevo proyecto podrías usar `npx` o instalar la [Semaphore CLI](https://github.com/semaphore-protocol/semaphore/tree/main/packages/cli) globalmente usando `npm` y entonces crear un nuevo proyecto usando el comando `semaphore create`. Vea [Configuración Rápida](https://semaphore.pse.dev/docs/quick-setup) para más información.
Para crear un nuevo proyecto podrías usar `npx` o instalar la [Semaphore CLI](https://github.com/semaphore-protocol/semaphore/tree/main/packages/cli) globalmente usando `npm` y entonces crear un nuevo proyecto usando el comando `semaphore create`. Vea [Configuración Rápida](https://docs.semaphore.pse.dev/quick-setup) para más información.

Hay tres plantillas soportadas en este momento: `contracts-hardhat`, `monorepo-ethers` y `monorepo-subgraph`.

Expand All @@ -73,7 +73,7 @@ También puede probar la aplicación Semaphore boilerplate en vivo aquí: https:

### Instalación manual

Alternativamente, también puede instalar todos los paquetes manualmente usando npm o yarn siguiendo la [documentación de Semaphore](https://semaphore.pse.dev/docs/introduction).
Alternativamente, también puede instalar todos los paquetes manualmente usando npm o yarn siguiendo la [documentación de Semaphore](https://docs.semaphore.pse.dev).

## ¿Cómo puedo contribuir al protocolo?

Expand Down
Loading

0 comments on commit b4542a5

Please sign in to comment.