anoma / vamp-ir

Vamp-IR is a proof-system-agnostic language for writing arithmetic circuits
https://anoma.github.io/VampIR-Book/
Apache License 2.0
156 stars 44 forks source link

Writing our first Vamp-IR examples #7

Closed simonmasson closed 1 year ago

simonmasson commented 2 years ago

As far as I understand, the goal of Vamp-IR is to be able to use complicated circuits in a simple way. I would like to have a practical example with a "complicated" circuit. For example, we can consider a hash function circuit, very useful for ZK proofs applications. Depending on your curve system, you can use Poseidon over:

The circuit can be designed differently depending on the implementation. For example it could either compute the hash and output it as a variable, either (given input and output) check that output is the hash of input. Using Vamp-IR, the user doesn't care about this implementation detail and is able to create the circuit in a simple way like:

// this is vamp-ir code
output = Poseidon(input)

(somewhere, the user needs to decide on the backend: Zcash or ZK-Garage)

My questions:

  1. Can we already do this kind of example with Vamp-IR?
  2. What is needed to achieve this example?
  3. Do we need Juvix at some point for this?
CarloModicaPortfolio commented 1 year ago

Hi, there is now a balke2s hash in the repo, that can be used as a Vamp-IR example