microsoft / Spartan

Spartan: High-speed zkSNARKs without trusted setup
MIT License
689 stars 119 forks source link

How Do I Construct R1CS Using Negative Values? #43

Closed AtropineTears closed 2 years ago

AtropineTears commented 2 years ago

Hi,

I am looking to construct a R1CS but need some help. I would like to know how I can use a negative value for the R1CS like it says in this blog post. They use x2 - 4 but i do not know how to make an R1CS Circuit with negative numbers.

I would really appreciate some help with a few other things too.

Thank you.

srinathsetty commented 2 years ago

Hi @AtropineTears For -4, you can use p - 4 where p = 2^{252}+27742317777372353535851937790883648493 (the prime field in the scalar field of Ristretto/Curve25519). Does this help?

srinathsetty commented 2 years ago

Closing the issue for now. Please reopen if the above does not work.