-
Notifications
You must be signed in to change notification settings - Fork 164
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
Feat/pedersen batch verify #517
Conversation
📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, but I have some ideas on making more cleaner and flexible to use.
I messed up the comments though - I added mostly to the generated code, but they go for the template.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me now. I paraphrased the method documentation so that it would look nicely on the documentation site. I also added package examples which should show on on the documentation site, so the users would know how to combine different methods (and for example how to generate bases for the setup etc.). Have a look at my changes and they seem good, then it is good to merge on my side 👍
Perfect thank you for the modifications! |
Description
This PR implements a$n$ proofs of knowledge from keys with the same base $G_2$ point but possibly different $\sigma$ parameters using $n+1$ pairings instead of $2n$ .
BatchVerify
function that can verifyThe existing
BatchProve
method which folds both commitments and proofs remains valid by the following extractor construction, but is not suitable to some applications.Let V be able to provide convincing folded proofs of knowledge for$C_i = x_i B$ for $i\in {1,2 }, B\in G_1$ with high probability. Then, an extractor is able, by rewinding, to obtain two correct folded proofs of knowledge $\Pi, \Pi' \in G_1$ corresponding to distinct challenges $r,r'\in \mathbb F_r$ respectively. Then we have $e(C_1 + rC_2,G^\sigma)=e(\Pi,G), e(C_1+r'C_2,G^\sigma)=e(\Pi',G).$ Then we get $e\big((r-r')C_2, G^\sigma\big)=e(\Pi-\Pi',G)\Rightarrow e(C_2,G^\sigma)=e\big(\frac 1 {r-r'}(\Pi-\Pi'), G\big)$ , thus obtaining a proof in the original scheme of knowledge of $C_2$ . A proof of knowledge of $C_1$ can similarly can be extracted.
The new scheme requires the prover to send the$n$ individual proofs to the verifier. The verifier randomizes $r$ without sending it as a challenge to the prover. It folds the commitments into $C = C_1 + rC_2+...+r^{n-1}C_n$ and checks that $e(C, G)=e(\Pi_1,G^{\frac 1 {\sigma_1}})...e(\Pi_n, G^{\frac 1{\sigma_n}})$ . Then, from $1=e(C_1^{\sigma_1}-\Pi_1,G)e^r(C_2^{\sigma_2}-\Pi_2,G)...e^{r^{n-1}}(C_n^{\sigma_n}-\Pi_n,G)$ one can deduce with high probability that $e(C_i,G^{\sigma_i})=e(\Pi_i,G)$ for $i=1..n$ .
Type of change
Please delete options that are not relevant.
Interface changes
Setup
function no longer takes the bases in variadic form. This is to provide the option to the user to set theG2
point themselves instead of having it randomized.BatchVerify
function is added to verify many proofs of knowledge with the same G2 point efficiently. It may be confusing to users thatBatchVerify
andBatchProve
do not correspond.How has this been tested?
Please describe the tests that you ran or implemented to verify your changes. Provide instructions so we can reproduce.
Checklist:
golangci-lint
does not output errors locally