Skip to content
This repository was archived by the owner on Apr 27, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions 0000-zk-framework.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
[//]: # (SPDX-License-Identifier: CC-BY-4.0)

- Feature Name: r1cs-select
- Start Date: 2021-11-10
- RFC PR: (leave this empty)
- Ursa Issue: (leave this empty)
- Version: 1

# Summary
[summary]: #summary
Generic zero knowledge libraries such as bellman, bulletproof, etc come with two components
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would like to see references to bellman and bulletproof libraries

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'a' rust R1CS library or 'the' R1CS library? In other words, does this sentence talk about how this zero knowledge framework is a rust library for R1CS, or how this zero knowledge framework uses an R1CS library?
If it is the former, that should be clarified, if it is the latter, there should be a reference to the R1CS library.

plan to support more backends.

Current version of the implementation: https://github.com/hyperledger/ursa/pull/192

# Motivation
[motivation]: #motivation

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another place for links

backend.

# Guide-level explanation
[guide-level-explanation]: #guide-level-explanation

This project demonstrates R1CS logic with backends to Bellman and Bulletproofs.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another place for links


Use the following commands to execute each step of the process. The steps are setup (bellman),
prove, and verify.

Setup

`cargo run -- setup --backend=bellman | tee params.json`

Prove

`echo '"1234"' > witness.hex`
`cargo run -- prove --backend=bellman --parameters=params.json --witness=witness.hex | tee
proof.json`

or

`cargo run -- prove --backend=bulletproofs --witness=witness.hex | tee proof.json`

Verify

`cargo run -- verify --backend=bellman --parameters=params.json --input=proof.json`

or

`cargo run -- verify --backend=bulletproofs --input=proof.json`

# Reference-level explanation
[reference-level-explanation]: #reference-level-explanation
An R1CS instance can be defined by three matrices A, B and C. They correspond to the NP-complete
decision problem: whether there is a witness vector w s.t. Aw x Bw = Cw ?

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
r1csbellman.rs, r1csbulletproof.rs: modules that convert r1cs spec to underlying backends
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you include a normative r1cs definition and/or spec?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in the new commit

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above it talked about an R1CS library. This talks about an R1CS spec. In my mind those are two very different things. I don't see references here to either.



# Drawbacks
[drawbacks]: #drawbacks

We have chosen r1cs rust library (https://github.com/mir-protocol/r1cs) as frontend, which might
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here we have a link to the R1CS library!
I suppose this probably answers a question I had earlier about 'a' library vs 'the' library.

I recommend creating a # References section and putting all of the references in there, then linking to that section everywhere you need to in the text.

not be the preferred frontend for all users.

# Rationale and alternatives
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to see some content in this section

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in the new commit

[alternatives]: #alternatives

- Why is this design the best in the space of possible designs?
- What other designs have been considered and what is the rationale for not
choosing them?
- What is the impact of not doing this?
- For incorporating new protocol implementations what other implementations
exist and why were they not selected?
- For new protocols, what related protocols exist and why do the not satisfy
requirements?
Comment on lines +80 to +87
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are questions that should be answered in the alternatives section. The snippet below is okay, but doesn't go into the detail that answering these questions would.

While I would prefer to have actual answers to these questions, if the text below is intended to be sufficient, then the questions themselves should be removed.


One alternative is to use zk-interface (mentioned in prior arts). However, in our
experience setting up zk-interface can be difficult. Other alternative can be directly using the
underlying Zero Knowledge libraries such as Bellman, Bulletproof, etc. However, that would make the
development process less flexible.

# Prior art
[prior-art]: #prior-art

zk-interface (https://github.com/QED-it/zkinterface) is the defacto prior art. It has extensive
features. However, it is not being actively maintained and set up is relatively complex.

# Unresolved questions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section as well should be filled out

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in the new commit

[unresolved]: #unresolved-questions

- What parts of the design do you expect to resolve through the RFC process
before this gets merged?
- What parts of the design do you expect to resolve through the implementation
of this feature before stabilization?
- What related issues do you consider out of scope for this RFC that could be
addressed in the future independently of the solution that comes out of this
RFC?
Comment on lines +103 to +109
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comments here as in the alternatives section. The text is okay, but doesn't directly answer the questions.
It is also a good place to talk about all the things this RFC doesn't do (and why).

This proposal is very basic bare bone version of the framework. As a future work we would like to
include more Zero Knowledge Backends and Frontends. However, we might require a balance between
extensive functionality (zk-interface) and simplicity (this proposal).

# Changelog
[changelog]: #changelog

- [10 Jan 2019] - v2 - a one-line summary of the changes in this version.
Binary file added 0000-zk-framework.pptx
Binary file not shown.