Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KZero Wallet #2507

Merged
merged 8 commits into from
Feb 24, 2025
Merged

KZero Wallet #2507

merged 8 commits into from
Feb 24, 2025

Conversation

dejavukong
Copy link
Contributor

Project Abstract

KZero is a keyless, self-custodial wallet solution that leverages zero-knowledge proofs (ZKP) and OpenID protocol. With KZero, Web2 users can directly access the blockchain and send transactions using their Google, Apple, or other accounts, eliminating the need to safeguard mnemonic phrases or pre-install wallet applications. Users can access Web3 applications without any restrictions. KZero can be integrated into any Substrate-based chain without disrupting its existing account system.

Grant level

  • Level 1: Up to $10,000, 2 approvals
  • Level 2: Up to $30,000, 3 approvals
  • Level 3: Unlimited, 5 approvals (for >$100k: Web3 Foundation Council approval)

Application Checklist

  • The application template has been copied and aptly renamed (project_name.md).
  • I have read the application guidelines.
  • Payment details have been provided (Polkadot AssetHub (USDC & DOT) address in the application and bank details via email, if applicable).
  • I understand that an agreed upon percentage of each milestone will be paid in vested DOT, to the Polkadot address listed in the application.
  • I am aware that, in order to receive a grant, I (and the entity I represent) have to successfully complete a KYC/KYB check.
  • The software delivered for this grant will be released under an open-source license specified in the application.
  • The initial PR contains only one commit (squash and force-push if needed).
  • The grant will only be announced once the first milestone has been accepted (see the announcement guidelines).
  • I prefer the discussion of this application to take place in a private Element/Matrix channel. My username is: @_______:matrix.org (change the homeserver if you use a different one)

@github-actions github-actions bot added the admin-review This application requires a review from an admin. label Feb 14, 2025
Copy link
Contributor

github-actions bot commented Feb 14, 2025

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@dejavukong
Copy link
Contributor Author

I have read and hereby sign the Contributor License Agreement.

@takahser takahser self-requested a review February 17, 2025 10:33
Copy link
Collaborator

@takahser takahser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dejavukong thanks for submitting this, this already looks great!

I have just a few questions:

  • is the recovery mechanisms (for the case that ZK wallet is no longer maintained, at a later point) covered by this proposal?
  • how is the ephemeral private key stored on the user's client?

Feel free to also have a look at my inline questions.


(Step 0) We plan to use Groth16 for our protocol’s zkSNARK instantiation, requiring a singular generation of a structured common reference string (CRS) linked to the circuit. A ceremony is conducted to generate the CRS, which is used to produce the proving key in the ZK Proving Service, the verifying key in Project Authority.

(Step 1-3) The user begins by logging into an OpenID Provider (OP) to obtain a JWT token containing a defined nonce. In particular, the user generates an ephemeral KeyPair (eph_sk, eph_pk), along with expiry times (max_epoch) and randomness (jwt_randomness). Through these three parameters, the Wallet Extension can thus compute the nonce. After the user completes the OAuth login flow with the nonce, an JWT token can be retrieved.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you elaborate on how the randomness is generated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this content in a new section titled "Security and Privacy"

@semuelle semuelle requested a review from bhargavbh February 17, 2025 13:31
@dejavukong
Copy link
Contributor Author

@dejavukong thanks for submitting this, this already looks great!

I have just a few questions:

  • is the recovery mechanisms (for the case that ZK wallet is no longer maintained, at a later point) covered by this proposal?
  • how is the ephemeral private key stored on the user's client?

Feel free to also have a look at my inline questions.

@takahser the recovery mechanisms are added in the proposal, along with the storage of ephemeral private key, included in the new section titled "security and privacy"

Comment on lines +141 to +144
There are currently two potential, optional recovery mechanisms available:

1. **Built-in recovery mechanism in zklogin-pallet**: Each zklogin address can designate a recoverer. Under specific conditions, such as when a zklogin address has been inactive for N hours, the recoverer can send transactions and manage assets on behalf of the zklogin address.
2. **zklogin + proxy**: Through the proxy pallet, a zklogin address can set up 'delegate' or 'delayed-delegate' accounts. At any time when assets in the zklogin address face potential threats, users can immediately handle their assets securely through the proxy module.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, thanks for adding.
Could you clarify whether this is within the scope of this grant?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@takahser Given that these two mechanisms are not in conflict, we prioritize implementing the built-in recovery mechanism in this grant, while planning to develop the zkLogin + proxy mechanism at the application level in the future.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dejavukong sounds good to me. Could you add this to the deliverables (or in case it's already added, point out which deliverable this would equate to)?

After that I'm happy to approve it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@takahser included in Milestone 2

@dejavukong dejavukong requested a review from takahser February 17, 2025 16:18
Copy link
Collaborator

@takahser takahser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dejavukong thanks for the updates and clarifications, adding my approval here. I'll also mark the application as Ready for Review and ping the rest of the grants committee to have a look at it.

In the meanwhile, could you submit KYB for your company? This should be the same entity that is going to send the invoices after completing each of the milestones.

@takahser takahser self-assigned this Feb 18, 2025
@takahser takahser added the ready for review The project is ready to be reviewed by the committee members. label Feb 18, 2025
Copy link
Collaborator

@takahser takahser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dejavukong sorry, I just realized that the DOT percentage is currently missing.
Note that at least 50% of the grants are supposed to be paid in DOT, see our template.

DOT %: Percentage of Total Costs to be paid in (vested) DOT (≥ 50%)

Could you add this info as well? After that I'll add my approval again.

@dejavukong
Copy link
Contributor Author

dejavukong commented Feb 18, 2025

@dejavukong sorry, I just realized that the DOT percentage is currently missing. Note that at least 50% of the grants are supposed to be paid in DOT, see our template.

DOT %: Percentage of Total Costs to be paid in (vested) DOT (≥ 50%)

Could you add this info as well? After that I'll add my approval again.

@takahser Added.

@dejavukong dejavukong requested a review from takahser February 18, 2025 03:52
takahser
takahser previously approved these changes Feb 18, 2025
semuelle
semuelle previously approved these changes Feb 18, 2025
Copy link
Member

@semuelle semuelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me, happy to support this.

@bhargavbh
Copy link
Contributor

The proposal contains sufficient technical depth and looks thorough. In general, this would be useful feature for onboarding new users and i am happy to support it.
I have one question, how does the attacker/threat model differ from Sui's zkLogin, is there any additional Substrate based assumption which crawls in your design?

@dejavukong
Copy link
Contributor Author

dejavukong commented Feb 18, 2025

@bhargavbh
Thank you for your support and insightful question. While we acknowledge Mysten Labs' pioneering work on zkLogin and consider their implementation as best practice (we follow their approach on salt service and ephemeral key storage), there are several key differences in our design due to Substrate's unique characteristics:

Address Format:
While Sui uses different prefixes to distinguish different address types, in Polkadot, address prefixes are reserved for network identification. Therefore, KZero's zkLogin addresses follow the standard Substrate address generation scheme without special prefixes. This design choice ensures seamless compatibility across all Relay chains and Parachains.

Replay Attack Prevention:
Due to fundamental differences between Sui's UTXO-like model (which prevents replay through object references) and Polkadot's Account model, we've implemented it following Polkadot's design. In KZero, the ephemeral private key signs transactions using the zkLogin address's nonce rather than a separate ephemeral key nonce. This ensures replay protection while maintaining compatibility with Substrate's account model.

Enhanced Recovery Mechanism:
KZero's zkLogin runtime incorporates a built-in recovery mechanism for each zkLogin address. This provides an additional security layer ensuring users can recover their assets even in extreme scenarios (like service interruption), which is particularly important for Substrate-based chains.

@dejavukong dejavukong requested a review from bhargavbh February 18, 2025 11:54
Noc2
Noc2 previously approved these changes Feb 19, 2025
keeganquigley
keeganquigley previously approved these changes Feb 19, 2025
Copy link
Contributor

@keeganquigley keeganquigley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the deep dive @takahser LGTM. Excited to see this on Polkadot!

Copy link
Member

@PieWol PieWol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @dejavukong, this looks interesting. Happy to support this. Just one question: Which OAuth providers will you support in the SDK and thus the demo website of Milestone 4? Will I be able to login with e.g. my Google account?

@dejavukong
Copy link
Contributor Author

@PieWol Sure thing! We'll set up with a frontend page and demo-kzero-node(with zklogin runtime) so you can try out all the features.

PieWol
PieWol previously approved these changes Feb 20, 2025
@PieWol
Copy link
Member

PieWol commented Feb 20, 2025

@dejavukong could you please also include a DOT payment address?

@dejavukong
Copy link
Contributor Author

@PieWol Included.

@PieWol
Copy link
Member

PieWol commented Feb 20, 2025

Hey @dejavukong ,
sorry for the individual requests. We also would need you to change the USDT request to USDC. We only pay in DOT and USDC at the moment. See here.

Once thats done I'll re-approve.

Copy link
Member

@PieWol PieWol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick changes.

@semuelle
Copy link
Member

We have enough votes to approve the grant, @dejavukong, but we are still waiting for you finishing the KYB process, as requested above.

@semuelle semuelle removed the request for review from bhargavbh February 21, 2025 10:47
@keeganquigley keeganquigley removed the admin-review This application requires a review from an admin. label Feb 24, 2025
@semuelle semuelle merged commit 07c25db into w3f:master Feb 24, 2025
7 of 9 checks passed
Copy link
Contributor

Congratulations and welcome to the Web3 Foundation Grants Program! Please refer to our Milestone Delivery repository for instructions on how to submit milestones and invoices, our FAQ for frequently asked questions and the support section on our website for more ways to find answers to your questions.

Before you start, take a moment to read through our announcement guidelines for all communications related to the grant or make them known to the right person in your organisation. In particular, please don't announce the grant publicly before at least the first milestone of your project has been approved. At that point or shortly before, you can get in touch with us at [email protected] and we'll be happy to collaborate on an announcement about the work you’re doing.

Also, if you haven't yet, consider signing up for the Polkadot Alpha Program. The program offers plenty of resources for people building on Polkadot. Lastly, please remember to let us know in case you run into any delays or deviate from the deliverables in your application. You can either leave a comment here or directly request to amend your application via PR. We wish you luck with your project! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review The project is ready to be reviewed by the committee members.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants