- The Ether EOA-auth SDK (EOA TX Buider) would be implemented with the following technical stack:
- ZK circuit: written in
CircomandSnarkjs. - Smart contract: written in Solidity.
- ZK circuit: written in
-
The Ether EOA-auth SDK (EOA TX Buider) would be used for account recovery as a secondary account recovery module in the ZK Email Recovery. (NOTE:At the moment, the Ether Email-auth SDK (Email TX Builder) has been used as a primary account recovery module for the ZK Email Recovery. Basically, the Ether EOA-auth SDK (EOA TX Buider) would be assumed that it work with the Ether Email-auth SDK (Email TX Builder) in the ZK Email Recovery)
-
The EOA TX Builder would be the module:
- which can generate a proof to prove that a given
accountaddress is associated with aguardianaddress. (NOTE:This proof is called aEOA proofin this repo) - which can generate the Verifier contract that can verify the
EOA proof.
- which can generate a proof to prove that a given
-
The advantage of using an
EOA proofis that a givenguardianaddress, which is associated with anaccountowner, can be verified without revealing theguardianaddress.
Integration with the Email-Recovery module
- The Ether EOA-auth SDK (EOA TX Buider) would be assumed that it work with the Ether Email-auth SDK (Email TX Builder) in the ZK Email Recovery
-
Integration summary and approach: https://github.com/masaun/email-recovery/blob/masaun_%2366_prototype-new-ERC7579-recovery-module/doc/summary-and-approach.md
-
The architecture of the proof generation with the Email-auth (which generate and verify a
Email proof)and EOA-auth (which generate and verify aEOA proof)(Source: https://github.com/masaun/eoa-tx-builder/blob/develop/doc/diagrams/architecture_proof-generation_with_Email-Auth_and_EOA-auth.png )
-
The architecture of the account recovery flow including both the Email-auth (which generate and verify a
Email proof)and EOA-auth (which generate and verify aEOA proof)(Source: https://github.com/masaun/eoa-tx-builder/blob/develop/doc/diagrams/architecture_of_account-recovery-flow_including_EOA-auth.png )
-
- 0/ Install node modules in the root directory
yarn install- 1/ Move to the
./circuitsdirectory and install node modules
cd circuits && yarn install- 2/ Compiling ZK circuit
circom multiplier2.circom --r1cs --wasm --sym --c- 3/ Move to the
./circuits/eoa_auth_jsdirectory
cd eoa_auth_js- 4/ Computing the witness with WebAssembly
node generate_witness.js eoa_auth.wasm input.json witness.wtns- 5-1/ Start a new "powers of tau" ceremony
snarkjs powersoftau new bn128 12 pot12_0000.ptau -v- 5-2/ Contribute to the ceremony
snarkjs powersoftau contribute pot12_0000.ptau pot12_0001.ptau --name="First contribution" -v- 6-1/ Start the generation of this phase 2:
snarkjs powersoftau prepare phase2 pot12_0001.ptau pot12_final.ptau -v- 6-2/ Generate a
.zkeyfile that will contain the proving and verification keys (in phase 2)
snarkjs groth16 setup eoa_auth.r1cs pot12_final.ptau eoa_auth_0000.zkey- 6-3/ Contribute to the phase 2 of the ceremony
snarkjs zkey contribute multiplier2_0000.zkey eoa_auth_0001.zkey --name="1st Contributor Name" -v- 6-4/ Export the verification key:
snarkjs zkey export verificationkey eoa_auth_0001.zkey verification_key.json- 7/ Generate a zk-Proof (Groth16 Proof)
- outputs 2 files are also generated at this point:
proof.json: it contains the proof.public.json: it contains the values of the public inputs and outputs.
- outputs 2 files are also generated at this point:
snarkjs groth16 prove eoa_auth_0001.zkey witness.wtns proof.json public.json- 8/ Verifying a Proof
- 3 files (
verification_key.jsonandproof.jsonandpublic.json) would be used to check - if the proof is valid. - If the proof is valid, the command outputs an
OKin terminal.
- 3 files (
snarkjs groth16 verify verification_key.json public.json proof.json- 9/ Generate a Solidity Verifier contract
snarkjs zkey export solidityverifier eoa_auth_0001.zkey verifier.sol- Run test (using
circom_tester)
/// NOTE: The directory is ./circuits
cd circuits
yarn test- 1/ Move to the
./contractsdirectory
cd contracts- 2/ Compile SC (Main file:
EoaAuth.sol)
forge build- 3/ Run Test (File:
EoaAuth.t.sol)
/// [NOTE]:Make sure the directory is ./contracts
cd contracts
forge test -vvv- Document of
CircomandSnarkjs:https://docs.circom.io/getting-started/writing-circuits/ - Email Recovery module:https://github.com/zkemail/email-recovery
- Email-auth SDK (email-tx-builder):https://github.com/zkemail/email-tx-builder