The repository is divided into three components: web app, contracts and subgraph. The app allows users to create their own Semaphore identity, join a group with their usernames and then send their feedback anonymously (currently on Goerli). |
---|
Use this repository as a Github template.
Clone your repository:
git clone https://github.com/<your-username>/<your-repo>.git
and install the dependencies:
cd <your-repo> && yarn
Copy the .env.example
file as .env
:
cp .env.example .env
and add your environment variables.
Note
You should at least set a valid Ethereum URL (e.g. Infura) and a private key with some ethers.
- Go to the
apps/contracts
directory and deploy your contract:
yarn deploy --semaphore <semaphore-address> --group <group-id> --network goerli
-
Update your
.env
file with your new contract address and group id. -
Change the
address
(with the new contract address) andstartBlock
(with the block number of the transaction where the contract was created) in theapps/subgraph/subgraph.yaml
file. -
Copy your contract artifacts from
apps/contracts/build/contracts/contracts
folder toapps/subgraph/contract-artifacts
andapps/web-app/contract-artifacts
folders manually. Or runyarn copy:contract-artifacts
in the project root to do it automatically. -
Deploy the subgraph again.
Note
Check the Semaphore contract addresses here.
Warning
The group id is a number!
- Go to the
apps/subgraph
directory and update thesubgraph.yaml
file by setting your contract address. - Authenticate the account with your access token:
yarn auth <access-token>
- Deploy your subgraph:
yarn deploy <account-name/subgraph-name>
You can start your app locally or you can easily deploy it to Vercel or AWS Amplify.
yarn start
Run ESLint to analyze the code and catch bugs:
yarn lint
Run Prettier to check formatting rules:
yarn prettier
or to automatically format the code:
yarn prettier:write