microsoft/Spartan

How to use externally generated R1CS?

Tails opened this issue · 3 comments

Tails commented

I'm looking to use Spartan as a backend.
The README states the following:

libspartan supports NP statements expressed as rank-1 constraint satisfiability (R1CS) instances, a popular language for which there exists efficient transformations and compiler toolchains from high-level programs of interest.

But how do you use this library with R1CS constraints as generated by such toolchains?

Tails commented

I see, one would have to parse the external format, create the A-B-C scalars and instantiate the R1CSInstance::new object with them. And from there on one could follow the instructions in the README. Correct?

Yes, that is exactly right.

R1CSInstance type is not public but as mentioned in README, we are working on adding public APIs to specify an R1CS statement:

Development is ongoing (PRs are welcome!). For example, the library does not yet offer APIs to specify an NP statement, but we will in the future offer standardized APIs and also integrate with a compiler that produces R1CS instances from high level programs.

Closing this issue for now. Please see the third example in README where we demonstrate new APIs for specifying an R1CS instance.