0xPARC / zkrepl

An online playground for zero knowledge circuits
https://zkrepl.dev/
GNU General Public License v3.0
143 stars 23 forks source link

How to wirte array input? #18

Closed UIZorrot closed 10 months ago

UIZorrot commented 11 months ago
template test(n) { 
    signal input c[n];  // Constants
    signal output out[n];

    for (var i=0; i<n; i++) {
        out[i] <== c[i];
    }
}

component main = test(1);

/ INPUT = { How could I write array input c[n]? } /

mrthankyou commented 11 months ago

This successfully worked for me:

pragma circom 2.1.6;

include "circomlib/poseidon.circom";
// include "https://github.com/0xPARC/circom-secp256k1/blob/master/circuits/bigint.circom";

template Bin2Num(n) {
    signal input in[n];
}

component main = Bin2Num(2);

/* INPUT = {
    "in": ["1", "2"]
} */
UIZorrot commented 10 months ago

It's been a long while, but thanks! it's working