Semaphore contracts to manage groups and broadcast anonymous signals.
To learn more about contracts visit semaphore.appliedzkp.org.
Install the @semaphore-protocol/contracts package with npm:
npm i @semaphore-protocol/contractsor yarn:
yarn add @semaphore-protocol/contractsCompile the smart contracts with Hardhat:
yarn compileRun Mocha to test the contracts:
yarn testYou can also generate a test coverage report:
yarn test:coverageOr a test gas report:
yarn test:report-gasDeploy the Semaphore.sol contract without any parameter:
yarn deploy:semaphoreor deploy it by providing the addresses of the contracts/libraries on which it depends:
yarn deploy:semaphore --semaphoreVerifier <address>Note
Runyarn deploy:semaphore --helpto see the complete list.
If you want to deploy your contract in a specific network you can set up the DEFAULT_NETWORK variable in your .env file with the name of one of our supported networks (hardhat, localhost, goerli, arbitrum). Or you can specify it as an option:
yarn deploy:semaphore --network goerli
yarn deploy:semaphore --network sepolia
yarn deploy:semaphore --network mumbai
yarn deploy:semaphore --network optimism-goerli
yarn deploy:semaphore --network arbitrumIf you want to deploy contracts on Goerli or Arbitrum, remember to provide a valid private key and an Infura API in your .env file.