Giter Club home page Giter Club logo

zk-p2p's Introduction

ZKP2P

A trustless P2P fiat onramp powered by ZK proofs

ZKP2P is a trustless and privacy-preserving fiat-to-crypto onramp powered by ZK proofs. This (V2) repo is currently under active development. ZKP2P is currently live in Alpha which is a productionized version with audits and supporting Venmo, a popular P2P payment network in the US. Try it out at zkp2p.xyz

X-blob-background-1500x500px

Overview

The network is powered by ZK proofs of DKIM signatures in payment confirmation emails, proving the SHA256, email regex, and RSA without revealing sensitive contents in the email. We are working with the Privacy and Scaling Exploration (PSE) group to explore applications for zero-knowledge proving systems

Follow us on our Twitter and our Telegram for announcements and updates!

After the launch of V2, we will continue experimenting with new infrastructure to improve the UX by bringing down proving times and integrating other payment rails such as Paypal and Transferwise.

If you're interested in collaborating, please reach out to us on our Telegram.

How To:

Fetch Your Venmo ID

ZKP2P off-ramping requires submitting Venmo IDs on chain so the on-rampers knows where to send the payment. A Venmo ID is unique identifier (e.g. 1234567891011121314 up to 19 digits) for your Venmo account that is separate from your handle (@Venmo-User). You can look up your Venmo ID using one of the following methods:

  • Open any Venmo payment receipt email and click on 'Show original' and search for user_id. As of writing these instructions [4/30/2023], you should be able to locate your id in multiple places but may need to splice the 3D encoding in front of the id.
  • Paste curl https://account.venmo.com/u/[YOUR_VENMO_HANDLE] | grep -o '"user":{"displayName":"[^"]*","id":"[0-9]*"' | sed 's/.*"id":"\([0-9]*\).*/\1/' into the command line, replacing YOUR_VENMO_HANDLE with your Venmo username without the @ e.g. Alex-Soong.

To verify your id, you can go to https://venmo.com/code?user_id=[YOUR_VENMO_ID] and the page should resolve to a profile for your account.

Acknowledgements

This project has been supported by a grant from EF and PSE. Find our grant proposal here. We thank them for their generous support.

zk-p2p's People

Contributors

0xsachink avatar asoong avatar bweick avatar fivecut avatar justinkchen avatar richardliang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

zk-p2p's Issues

Circuit Optimization: Unused Signals in HDFC UPI Subject Circuit

In /circuits-circom/regexes/hdfc/hdfc_upi_subject.circom, there is no reveal0 output signal, but there is still an is_consecutive signal. This signal is therefore not needed since it is only used to constrain reveal0. Right now, it doesn't constrain anything, so it is unused.

component final_state_result = MultiOR(num_bytes+1);
for (var i = 0; i <= num_bytes; i++) {
final_state_result.in[i] <== states[i][47];
}
out <== final_state_result.out;
signal is_consecutive[msg_bytes+1][2];
is_consecutive[msg_bytes][1] <== 1;
for (var i = 0; i < msg_bytes; i++) {
is_consecutive[msg_bytes-1-i][0] <== states[num_bytes-i][47] * (1 - is_consecutive[msg_bytes-i][1]) + is_consecutive[msg_bytes-i][1];
is_consecutive[msg_bytes-1-i][1] <== state_changed[msg_bytes-i].out * is_consecutive[msg_bytes-1-i][0];
}
}

I recommend removing is_consecutive from the circuit.

User can change venmo id during registration

The venmo_actor_id 'reveal' outputs an array where everything is 0s except for where the venmo id is:

signal output reveal[num_bytes];
for (var i = 0; i < num_bytes; i++) {
reveal[i] <== in[i] * states[i+1][1];
}

So the registration circuit will call ShiftAndPack on this output array, to shift the array to the point the venmo id number starts. However, the number of shifts is up to the user. The user can input any number as the shift count as the signal venmo_actor_id_idx:

signal input venmo_actor_id_idx;
signal reveal_actor_packed[max_actor_id_packed_bytes];
signal (actor_id_regex_out, actor_id_regex_reveal[max_body_bytes]) <== VenmoActorId(max_body_bytes)(in_body_padded);
signal is_found_actor_id <== IsZero()(actor_id_regex_out);
is_found_actor_id === 0;
// PACKING
reveal_actor_packed <== ShiftAndPack(max_body_bytes, max_actor_id_len, pack_size)(actor_id_regex_reveal, venmo_actor_id_idx);

As far as I know there are no constraints on this signal, so it's a degree of freedom for the user. I believe they can input different shifts to get possible venmo ids. For example, if the output array from venmo_actor_id is [0, 0, 0, 1, 2, 3, 4, 0, 0] and the actual id is [1, 2, 3, 4], then I believe the user could enter the shift as '5' (when it should be 4) to get an id of [2, 3, 4, 0].

Let me know if my thinking is correct here. If so, I believe we need some additional constraint on the input shift.

Add Wise integration

Wise.com is a popular money transfer service in Europe. It sends emails with the transfer amount when you send or receive a payment.

Mobile wallet intergration

Momo is mobile wallet in Vietnam. Any idea for this integration?.They dont have email receipt, just in app message.

Oracle for DKIM key rotations

From reading the docs it appears that whenever DKIM keys get rotated governance needs to update the contract, which may cause service disruptions.

An oracle could be implemented to enforce the updates in real time, it could leverage Chainlink functions for verification or some other decetralized platform like Phala Network.

Are there any plans around adding oracle functionality already?

Risk of chargebacks?

The Bisq p2p Bitcoin onramping software has made the decision not to include Venmo as a payment method, due to the frequency of chargebacks
bisq-network/growth#221

Do you have reason to expect that the zk-p2p setup is robust to these problems?
Would the zk verification technique generalize to other payment providers?

Circuit Optimization: Extra signal row

This is an optional nitpick optimization. I know the circuits are generated from a script so I understand not wanting to change it. Just adding this for informational purposes.

In the hdfc_accnum.circom circuit, there is the variablesignal is_substr0[msg_bytes][3];. However, the first column is set to all 0s and never changed. So it's unnecessary and the variable can be made a 2 column signal instead of 3.

Regex Circuit Optimizations

For many of the regex circuits, I am seeing duplicate circuit patterns that may be simplified.

For example, in venmo_actor_id.circom, this less than circuit is created twice:

lt[0][i] = LessThan(8);
lt[0][i].in[0] <== 47;
lt[0][i].in[1] <== in[i];

lt[2][i] = LessThan(8);
lt[2][i].in[0] <== 47;
lt[2][i].in[1] <== in[i];

So just taking the venmo_actor_id as an example, I would simplify this for-loop block:

lt[0][i] = LessThan(8);
lt[0][i].in[0] <== 47;
lt[0][i].in[1] <== in[i];
lt[1][i] = LessThan(8);
lt[1][i].in[0] <== in[i];
lt[1][i].in[1] <== 58;
and[0][i] = AND();
and[0][i].a <== lt[0][i].out;
and[0][i].b <== lt[1][i].out;
and[1][i] = AND();
and[1][i].a <== states[i][1];
and[1][i].b <== and[0][i].out;
lt[2][i] = LessThan(8);
lt[2][i].in[0] <== 47;
lt[2][i].in[1] <== in[i];
lt[3][i] = LessThan(8);
lt[3][i].in[0] <== in[i];
lt[3][i].in[1] <== 58;
and[2][i] = AND();
and[2][i].a <== lt[2][i].out;
and[2][i].b <== lt[3][i].out;
and[3][i] = AND();
and[3][i].a <== states[i][16];
and[3][i].b <== and[2][i].out;
multi_or[0][i] = MultiOR(2);
multi_or[0][i].in[0] <== and[1][i].out;
multi_or[0][i].in[1] <== and[3][i].out;
states[i+1][1] <== multi_or[0][i].out;

To:

`

    lt[0][i] = LessThan(8);
    lt[0][i].in[0] <== 47;
    lt[0][i].in[1] <== in[i];
    
    lt[1][i] = LessThan(8);
    lt[1][i].in[0] <== in[i];
    lt[1][i].in[1] <== 58;
    
    and[0][i] = AND();
    and[0][i].a <== lt[0][i].out;
    and[0][i].b <== lt[1][i].out;
    
    and[1][i] = AND();
    and[1][i].a <== states[i][1];
    and[1][i].b <== and[0][i].out;
    
   '''REMOVE (these are duplicates):
    lt[2][i] = LessThan(8);
    lt[2][i].in[0] <== 47;
    lt[2][i].in[1] <== in[i];
    
    lt[3][i] = LessThan(8);
    lt[3][i].in[0] <== in[i];
    lt[3][i].in[1] <== 58;
    
    and[2][i] = AND();
    and[2][i].a <== lt[2][i].out;
    and[2][i].b <== lt[3][i].out; '''
    
    and[3][i] = AND();
    and[3][i].a <== states[i][16];
    # CHANGE TO and[0] instead of and[2]
    and[3][i].b <== and[0][i].out;
    
    multi_or[0][i] = MultiOR(2);
    multi_or[0][i].in[0] <== and[1][i].out;
    multi_or[0][i].in[1] <== and[3][i].out;
    states[i+1][1] <== multi_or[0][i].out;

`

If my thinking makes sense, then we can get rid of two columns of the and component. These optimizations can be applied to the other regex circuits as well.

Bug: Registration Infinite Spinner

Attempting to paste my email data to register. While waiting for the tx to resolve, I observed a requirement I didn't bother to read "Provide a historical transaction email sent from Venmo containing "You paid" in the subject received after January 10th, 2024 to complete registration. Base ETH is required to submit a registration transaction. Base Bridge โ†—"

I missed the January 10th, 2024 part so I knew the tx should fail. I waited for over 60 seconds and the UI gave me no indication of failure, just infinite spin. I'm sorry if I have to state this explicitly but not resolving to something after 60 seconds (+15?) is bad UX. Thanks for the great product otherwise.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.