|
| 1 | +[//]: # (SPDX-License-Identifier: CC-BY-4.0) |
| 2 | + |
| 3 | +- Feature Name: r1cs-select |
| 4 | +- Start Date: 2021-11-10 |
| 5 | +- RFC PR: (leave this empty) |
| 6 | +- Ursa Issue: (leave this empty) |
| 7 | +- Version: 1 |
| 8 | + |
| 9 | +# Summary |
| 10 | +[summary]: #summary |
| 11 | +Generic zero knowledge libraries such as bellman, bulletproof, etc come with two components frontends and backends. Application programmers write their business logic using the frontend. The backend handles the underlying cryptography. Traditional zero knowledge libraries do not allow mix and match between different backends and frontends. In this zero knowledge framework one can use rust r1cs library as front end and either bellman or bulletproof as backend. In future versions we plan to support more backends. |
| 12 | + |
| 13 | +# Motivation |
| 14 | +[motivation]: #motivation |
| 15 | + |
| 16 | +Finding the appropriate zero knowledge framework (specifically the backend) is a non-trivial design choice for application developers. Different backends have different performance numbers depending on deployment options which might not be obvious to the application developer. Moreover, application developers can have different preferences for different frontends. To make life easy for application developers ideally we should have seemless compatibility between different frontend and backends. In the first version of this framework we support rust r1cs as front end, bellman and bullet proof as backend. |
| 17 | + |
| 18 | +# Guide-level explanation |
| 19 | +[guide-level-explanation]: #guide-level-explanation |
| 20 | + |
| 21 | +This project demonstrates R1CS logic with backends to Bellman and Bulletproofs. |
| 22 | + |
| 23 | +Use the following commands to execute each step of the process. The steps are setup (bellman), prove, and verify. |
| 24 | + |
| 25 | +Setup |
| 26 | + |
| 27 | +`cargo run -- setup --backend=bellman | tee params.json` |
| 28 | + |
| 29 | +Prove |
| 30 | + |
| 31 | +`echo '"1234"' > witness.hex` |
| 32 | +`cargo run -- prove --backend=bellman --parameters=params.json --witness=witness.hex | tee proof.json` |
| 33 | + |
| 34 | +or |
| 35 | + |
| 36 | +`cargo run -- prove --backend=bulletproofs --witness=witness.hex | tee proof.json` |
| 37 | + |
| 38 | +Verify |
| 39 | + |
| 40 | +`cargo run -- verify --backend=bellman --parameters=params.json --input=proof.json` |
| 41 | + |
| 42 | +or |
| 43 | + |
| 44 | +`cargo run -- verify --backend=bulletproofs --input=proof.json` |
| 45 | + |
| 46 | +# Reference-level explanation |
| 47 | +[reference-level-explanation]: #reference-level-explanation |
| 48 | + |
| 49 | +main.rs: this file contains sample code on how to use the framework, get_circuit function defines the circuit for which zero knowledge proofs will be generated |
| 50 | +r1csbellman.rs, r1csbulletproof.rs: modules that convert r1cs spec to underlying backends |
| 51 | + |
| 52 | + |
| 53 | +# Drawbacks |
| 54 | +[drawbacks]: #drawbacks |
| 55 | + |
| 56 | +We have chosen r1cs-select as frontend, which might not be preferred frontend for all users. |
| 57 | + |
| 58 | +# Rationale and alternatives |
| 59 | +[alternatives]: #alternatives |
| 60 | + |
| 61 | +- Why is this design the best in the space of possible designs? |
| 62 | +- What other designs have been considered and what is the rationale for not |
| 63 | + choosing them? |
| 64 | +- What is the impact of not doing this? |
| 65 | +- For incorporating new protocol implementations what other implementations |
| 66 | + exist and why were they not selected? |
| 67 | +- For new protocols, what related protocols exist and why do the not satisfy |
| 68 | + requirements? |
| 69 | + |
| 70 | +# Prior art |
| 71 | +[prior-art]: #prior-art |
| 72 | + |
| 73 | +zk-interface is the defacto prior art. It has extensive features. However, it is not being actively maintained and set up is relatively complex. |
| 74 | + |
| 75 | +# Unresolved questions |
| 76 | +[unresolved]: #unresolved-questions |
| 77 | + |
| 78 | +- What parts of the design do you expect to resolve through the RFC process |
| 79 | + before this gets merged? |
| 80 | +- What parts of the design do you expect to resolve through the implementation |
| 81 | + of this feature before stabilization? |
| 82 | +- What related issues do you consider out of scope for this RFC that could be |
| 83 | + addressed in the future independently of the solution that comes out of this |
| 84 | + RFC? |
| 85 | + |
| 86 | +# Changelog |
| 87 | +[changelog]: #changelog |
| 88 | + |
| 89 | +- [10 Jan 2019] - v2 - a one-line summary of the changes in this version. |
0 commit comments