From 1d7fc0ddea7781486155cdf85a8f4db3bd9d8be7 Mon Sep 17 00:00:00 2001 From: AndreaRettaroli Date: Sat, 7 Dec 2024 16:10:55 +0100 Subject: [PATCH] refactor --- README.md | 83 +++++++++++++++++--------------- apps/tutorial/src/useZkVerify.ts | 18 ++++--- start.sh | 22 +++++++++ 3 files changed, 76 insertions(+), 47 deletions(-) create mode 100755 start.sh diff --git a/README.md b/README.md index afde647..860ca0d 100644 --- a/README.md +++ b/README.md @@ -1,87 +1,90 @@ -# Galxe Identity Protocol x ZKVerify +# Galxe Identity Protocol x zkVerify -This project is developed for the ZKVerify online hackathon. It's a fork of the Galxe Identity Protocol [repository](https://github.com/galxe-identity-protocol/tutorial). You can find the original README [here](README-ORIGINAL.md). +This project is developed for the [zkVerify online hackathon](https://zkverify-zk-application-and-infrastructure-buildin.devfolio.co/overview). It's a fork of the Galxe Identity Protocol [repository](https://github.com/galxe-identity-protocol/tutorial). You can find the original README [here](README-ORIGINAL.md). + +The processed files for the hackathon are: -The files modified for the hackathon are: - [`src/useZkVerify.ts`](apps/tutorial/src/useZkVerify.ts) - [`package.json`](apps/tutorial/package.json) +- [`start.sh`](start.sh) + +The goal of this project is to demonstrate how to integrate zkVerify in Galxe Identity Protocol to significantly reduce verification costs without sacrificing security. + +## zkVerify -The goal of this project is to demonstrate how to integrate Galxe Identity Protocol with ZKVerify to significantly reduce verification costs without sacrificing security. +[zkVerify](https://zkverify.io/) is a modular blockchain focused on proof verification. It's specifically enables blockchain networks to offload the computationally heavy and expensive process of zk (zero-knowledge) proof verification, drastically reducing cost. It's support multiple verification schemes, including Groth16, Fflonk, Risc0 and more. ## Galxe -Galxe is a decentralized super app and web3's largest onchain distribution platform, with over 31 million active users and trusted by top partners like Optimism, Polygon, and many more. -Within its infrastructure, Galxe built Identity Protocol, a technology that utilizes privacy-preserving ZK technology to enable safe and seamless integration of digital identities across platforms. -Built on top of Identity Protocol, there is another product by Galxe, the Galxe Passport, chosen by over 1 million users to share their digital identity. -## ZKVerify -zkVerify is a modular blockchain focused on zero-knowledge (ZK) proof verification. It's specifically designed for verifying ZK proofs across different blockchains efficiently, with benefits in terms of cost reduction and fast verification times. -It's support multiple verification schemes, including Groth16, Fflonk, Risc0 and more. +Galxe is a decentralized super app and web3's largest onchain distribution platform, with over 31 million active users and trusted by top partners like Optimism, Polygon, and many more. +Within its infrastructure, Galxe built [Identity Protocol](https://www.galxe.com/identity), a technology that utilizes privacy-preserving ZK technology to enable safe and seamless integration of digital identities across platforms. +Built on top of Identity Protocol, there is another product by Galxe, the [Galxe Passport](https://www.galxe.com/passport), chosen by around 1 million users to share their digital identity. ## What we cooked -We created a new tutorial that follows the original one published by Galxe in this repo, but instead of doing an off-chain or on-chain verification, we use ZKVerify to verify the proof submitted. -> **Note:** Galxe has already integrated Nebra UPA in a tutorial, a protocol that can aggregate multiple proofs for reducing the verification cost. This validates our idea with zkVerify. +We created a new tutorial that follows the original one published by Galxe in this repo, but instead of doing an off-chain or an expensive on-chain verification, we integrated zkVerify technology as verification layer to efficiently verify the proofs. + +> **Note:** Galxe has already integrated Nebra UPA in a tutorial, a protocol that aggregates multiple proofs for reducing the verification cost. This validates our idea of introducing zkVerify. The process is divided in three steps: + 1. Issuer issuing a credential to the user 2. User generating a proof to prove some statements about the credential -3. Submitting the proof to ZKVerify to verify it +3. Submitting the proof to zkVerify to verify it We implemented the last step in two ways: -- Registering the verification key of the issuer onchain and then submitting the proof to ZKVerify -- Submitting the proof directly to ZKVerify with the verification key -We implementing the last step in two way: -- Registering the verification key of the issuer onchain and then submitting the proof to ZKVerify. -- Submitting the proof directly to ZKVerify with the verification key. - -+++ add considerations about the size +++ +- Registering the verification key of the issuer onchain and then submitting the proof to zkVerify, txHash: [0x11c2ddf64b5ddfcb1b1404d655ac41f23190f579f4bf2d79d612375df7a1fbf6](https://zkverify-explorer.zeeve.net/extrinsics/0x11c2ddf64b5ddfcb1b1404d655ac41f23190f579f4bf2d79d612375df7a1fbf6?tab=events&page=1) +- Submitting the proof directly to zkVerify with the verification key, txHash: [0x7d7a24d8c0c47fcc03f24ec54fa4575f6806bc7f9ef202eff7172496a14c27a2](https://zkverify-explorer.zeeve.net/extrinsics/0x7d7a24d8c0c47fcc03f24ec54fa4575f6806bc7f9ef202eff7172496a14c27a2?tab=events&page=1) ## How to run it Follow the original tutorial to initialize the repository: + ```bash # Quick start corepack enable corepack install pnpm build ``` + This will install the dependencies and build the project. Then go to the `apps/tutorial` folder and install the dependencies: + ```bash cd apps/tutorial -npm install +pnpm install ``` + Add `ZKVERIFY_SIGNER_PK` to the `.env` file with the private key of the account that will register the verification key onchain. Finally, run the script: + ```bash npm run useZkVerify ``` +--- +Alternatively you can run the script: +``` +chmod +x start.sh +./start.sh +``` -## Considerations -Galxe currently serves over 31 million active users and manages more than 350,000 credentials, making it the perfect candidate for testing scalable verification solutions. - -Assessed that zkVerify can reduce proof verification costs by >90% compared to native verification on Ethereum, at Galxe's scale, this translates to a significant costs dropping - a transformation that could generate millions in savings annually. - -Beyond pure cost reduction, this integration opens new possibilities for Web3 identity management. With over 1 million users actively using Galxe Passport, cheaper verification enables more frequent credential checks, enhanced privacy features, and broader accessibility to trustless credential systems for smaller projects. - -On a closing thought, we want to remark how specialized verification layers can solve real problems in large-scale identity systems, with the zkVerify-Galxe integration setting a new standard for efficient, accessible credential verification in Web3. - - - - - - - - - - - +Before to run make sure you have node latest version: +```bash +# For nvm users: +nvm install --lts +nvm use --lts +``` +## Considerations +Galxe currently serves over 31 million active users and manages more than 350k credentials, making it the perfect candidate for testing scalable verification solutions with zkVerify. +Assessed that zkVerify can reduce proof verification costs by >90% compared to native verification on Ethereum, at Galxe's scale, this translates to a significant costs dropping - a transformation that could generate millions in savings annually. +Beyond pure cost reduction, this integration opens new possibilities for Web3 identity management. With around 1 million users actively using Galxe Passport, cheaper verification enables more frequent credential checks, enhanced privacy features, and broader accessibility to trustless credential systems for smaller projects. +On a closing thought, we want to remark how specialized verification layers can solve real problems in large-scale identity systems, with the zkVerify-Galxe integration setting a new standard for efficient, accessible credential verification in Web3. diff --git a/apps/tutorial/src/useZkVerify.ts b/apps/tutorial/src/useZkVerify.ts index bfdc494..b046e2f 100644 --- a/apps/tutorial/src/useZkVerify.ts +++ b/apps/tutorial/src/useZkVerify.ts @@ -247,15 +247,15 @@ async function verifyWithZkVerify(proof: babyzkTypes.WholeProof): Promise