-
Notifications
You must be signed in to change notification settings - Fork 215
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
[about homomorphic update pedersen commitments] #235
Comments
P.S.
and the function I implement to subtract scalar(of unsigned char [32])
What I am testing is take a1(unsigned char [32]), a2, r1(unsigned char [32]), r2, comm1(a1G+r1H), comm2(a2G+r2H)
with secp256k1_pedersen_ecmult_256 looks like:
|
P.S.: The above does not work when Then I get: |
Hi,
What do you mean exactly?
I skimmed your code and what you're attempting to do seems roughly correct. I have no idea where your bug is. |
You need to know boh If you do know the openings to both commitments, and you want to prove that no overflow occurred, then you want to use a rangeproof. We have a production-ready but inefficient rangeproof in this library in the |
Hi @apoelstra @jonasnick What I have checked know is that the secp256k1_scalar_set_b32(&s, gn, &overflow) would not trigger overflow, so the problem seems not to come out with int secp256k1_scalar_sub_char BTW I am using
Does it affect anything? |
For more details when I am debugging:
based on whether the secp256k1_pedersen_commitment_load function triggers negate:
If the first and second commit load does not triggers: error would happen If the first trigers negate and second commit load does not triggers: error wont happen |
Ultimately you'll need a rangeproof-like object to guarantee no overflow. If you extend the commitments in this library past 64 bits you'll need to implement your own proof -- and be aware that if your commitment space is larger than half the group size, rangeproofs won't work and you'll have to do something much more elaborate. |
Thanks for the reply, so does that means that the commitment would not work if overflow happens? |
It will work fine, but these commitments commit to elements of the scalar group, not to integers. If you want to pretend that they're integers you need to restrict their range and use rangeproofs to enforce this. |
thanks, @apoelstra Furthermore, would it be possible for you to provide some insight into any potential mistakes I might be making based on the information provided above? |
@jscode017 have you tried running your program in valgrind? Also I think your context should be |
Thanks, I would try to run in valgrind and change the context. Appreciate for your help |
Hi I am new to this open-source community
Firstly, I want to say thank you to an amazing library
And may I ask that is there an implementation of semi homomorphic update of Pedersen commitments?
And looking at the interface, the message seems to be uint64_t, is there any way to deal with the overflow problem of the message?
e.g. if I would want to subtract two Pedersen commitments:
comm1-comm2
which would equal (m1-m2)G+(r1-r2)H
How could I deal with situations like m1<m2 and still stick to 64 bits unsigned integers?
TIA
The text was updated successfully, but these errors were encountered: