Questions tagged [zk-snark]

23 questions
1
vote
1 answer

Out signal based on two other our signals

I am trying to write a circuit to prove that a number is within a specified range. I am using the circomlib library : https://github.com/iden3/circomlib/tree/master/circuits comparators.circuit file. My code till now is this : template…
sonika
  • 239
  • 1
  • 2
  • 9
1
vote
1 answer

How to run a loop with unknown number of iterations in Circom?

I have the following circuit in Circom cicuit compiler: pragma circom 2.0.0; template MAIN() { signal len; len <== 32; for (k = 0; k < maplen; k++) { // do something } } component main = MAIN(); I'm getting an…
Ilia Sidorenko
  • 2,157
  • 3
  • 26
  • 30
1
vote
1 answer

How to use & (AND) operator in a signal in Circom

I'm trying to use & operator on a signal and get another signal in Circom circuit compiler language like so: pragma circom 2.0.0; template MAIN() { signal input a; signal output x; signal v; v <== 168; x <== v &…
Ilia Sidorenko
  • 2,157
  • 3
  • 26
  • 30
1
vote
1 answer

How to pass function argument by reference in Circom?

How to pass function argument by reference in the circom circuit language? I'm trying to do the following: pragma circom 2.0.0; function increment(foo) { foo++; } template MyTemplate() { signal input a; signal output b; var foo; …
Ilia Sidorenko
  • 2,157
  • 3
  • 26
  • 30
0
votes
0 answers

Why does snarkjs running on Node.js throw an instance of std::bal_alloc?

I'm running snarkjs over Node.js on a linux x64 machine with 256GB RAM and I have a zk-SNARK circuit composed by ~28M constraints. I want to execute the command snarkjs zkey new to generate a zkey file from a circuit compiled with circom, but when…
0
votes
1 answer

Idea behind Zksnark protocols

It has been for a while that I have been studying and making effort to underestand the zksnark protocols such as groth16 and plonk. However, things didn't well as I expected. To me, all zksnark protocols assume there is a program such f(x,w)=y, then…
Maneda
  • 1
0
votes
0 answers

range proof in zk-snark

The task is something like this. Alice must send Bob the money, but so that the amount remains hidden. How can this be done if only "hiding" balances are stored in the blockchain? How can I prove to someone that my balance is positive after the…
0
votes
1 answer

Blazor calling SnarkJS

For SnarkJS (https://github.com/iden3/snarkjs), there's an HTML example showing how to consume their ES6 javascript library: