This is the v2 implementation. For v1, please see the tag v1
- v1 Mainnet: 0xf50b818138e3848C314783FA593fb39653FB0178
- v1 Sepolia: 0x66ECf28b049f8b917C58B6e81a999CDF309283eA
This project uses Tenderly to fetch on-chain contract events because it has fewer limitations. Other RPC calls are handled via Alchemy.
For the ERC-4337 bundler:
- v1 uses Alchemy with Entrypoint v0.7
- v2 uses Pimlico with Entrypoint v0.8
The following steps will allow you to run this project’s frontend on localhost.
- Clone the repository
- Navigate to the frontend directory
- Copy the .env file from frontend/.env.example to frontend/.env
- Install dependencies by running
bun i - Set up deployer private key in .env
VITE_TEST_PRIVATE_KEY - Deploy contracts by running
bun run scripts/deploy.tsorbun run deploy - Configure deployed contract address in .env
VITE_ROYALTY_AUTO_CLAIM_PROXY_ADDRESS_BASE_SEPOLIA - Start the dev server by running
bun run dev
-
Copy
.env.exampleto.envand fill in:PRIVATE_KEYETHERSCAN_API_KEY
-
Create
RoyaltyAutoClaim.json:
{
"owner": "",
"admin": "",
"token": "",
"dkimRegistry": "0x3D3935B3C030893f118a84C92C66dF1B9E4169d6",
"emailFromAddress": "eth.taipei@gmail.com",
"semaphore": "0x8A1fd199516489B0Fb7153EB5f075cDAC83c693D"
}- Deploy to Base
forge script script/deployRoyaltyAutoClaim.s.sol \
--rpc-url https://mainnet.base.org \
--broadcast --verify-
Copy
.env.exampleto.envand fill in:PRIVATE_KEYETHERSCAN_API_KEY
-
Create
EmailVerifier.json:
{
"dkimRegistry": "0x3D3935B3C030893f118a84C92C66dF1B9E4169d6",
"emailFromAddress": "eth.taipei@gmail.com"
}- Deploy to Base
forge script script/deployEmailVerifier.s.sol \
--rpc-url https://mainnet.base.org \
--broadcast --verifyIf the circuit code has been modified, we need to run the following scripts to verify that the functionality is working correctly.
circuits
cd circuits/title_hash
nargo compile
cd circuits
bun run script/genProofTitleHash.ts ../emails/registration.eml
bun run script/genVerifier.ts title_hash
contract
forge build
forge test
forge fmt
frontend
make gen-types
make deploy
make prepare-circuit
cd frontend
bun run scripts/gen-proof.ts <EMAIL_FILENAME> <EMAIL_VERIFIER_ADDRESS>
bun run scripts/register.ts <EMAIL_FILENAME> <RAC_ADDRESS>
bun run scripts/update-recipient.ts test-update 0x43024C2e168E4554d71A93e1F8d1a083f8e6624E
(Update frontend .env for VITE_ROYALTY_AUTO_CLAIM_PROXY_ADDRESS_BASE_SEPOLIA)
bun run dev
forge test
forge test --gas-report
When used with the VS Code extension ryanluker.vscode-coverage-gutters, running Coverage Gutters: Display Coverage lets you see which functions are not yet covered by tests on the RoyaltyAutoClaim.sol.
forge coverage --report lcov
Ensure the storage layout is empty to avoid storage collision during future upgrades
forge inspect ./src/RoyaltyAutoClaim.sol:RoyaltyAutoClaim storage
If Error: failed to read artifact source file for... appears, you need to clean and recompile
forge clean
- UserOverrideableDKIMRegistry: 0x3D3935B3C030893f118a84C92C66dF1B9E4169d6
- ZK Email Deployed Contracts
- Remember to use the correct version when compiling and generating proofs.
Noir version: 1.0.0-beta.5+c651df6e2bf5db3966aa0c95abea2fc4c69d4513 "@aztec/bb.js": "0.84.0", "@noir-lang/noir_js": "1.0.0-beta.5", - The frontend scripts currently only implement the title_hash circuit.
- The integration is inspired by the design of mintmarks.fun
- For the legacy Circom implementation, please refer to the zkemail-circom tag.
- Semaphore: 0x8A1fd199516489B0Fb7153EB5f075cDAC83c693D
- Semaphore Deployed Contracts
- If the contract has been updated, remember to run
forge buildbeforebun run gen-types - Don’t use the alias @ in .ts files, because some scripts depend on functions from the src directory, and running those scripts directly won’t recognize @.