while making zk rollup circuit of merkle, i got this error. circuit

code for .circom:

pragma circom 2.0.3;
include "modules/mimicsponge.circom";

// ref: https://github.com/4undRaiser/circom_merkletree

template Merkle_Tree (n) {
   signal input leaves[n]; // taking in the input as a list of n leaves(in this case it is assumed that the number of leaves is 4)
   signal output root;  // output as a merkle root
   var N = n*2-1;
   signal hashes[N];
   component components[N];
    var j = 0;
    for(var i = 0; i < N; i++) {
        if(i < n) {
            // putting the hashes into leaves
            components[i] = MiMCSponge(1, 220, 1);
            components[i].k <== i;
            components[i].ins[0] <== leaves[i];
        } else {
            // constructing the merkle tree
            components[i] = MiMCSponge(2, 220, 1);
            components[i].k <== i;
            components[i].ins[0] <== hashes[j];
            components[i].ins[1] <== hashes[j+1];
        hashes[i] <== components[i].outs[0];

    // getting the hash of the merkle root
    root <== hashes[N-1];

// var public transactionsPerBatch=4;
component main {public [leaves]} = Merkle_Tree(4);
  • 1
    I’m voting to close this question because it's not about Ethereum. I doubt we have many Circom experts around here Commented Feb 27, 2023 at 11:28
  • Circom is used to make zk rollups in sidechain. rollups are most settled on ethereum blockchain only. so this is a question of ethereum.
    – aakash4dev
    Commented Mar 13, 2023 at 8:12

1 Answer 1


i just met this bug, you have to change the pot key to expand limit of constraints (2^12 in your case). the command that i use to create pot is below: snarkjs powersoftau new bn128 14 pot12_0000.ptau -v the limit of constraints is 2^14 now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.