JSON Files

This section covers the four primary JSON files you interact with during zk-SNARK circuit development and proof generation.

Input JSON

Must be declared/created manually

  • Purpose: Holds the actual inputs to your circuit.

  • Name: input.json

  • Used when generating the witness.

  • Keys must match the input signals defined in your .circom circuit.

  • Example:

{
    "inputs": [123456789, 987654321]
}

Proof JSON

  • Purpose: Contains the actual zk-SNARK proof generated from the circuit and witness.

  • Used during verification (off-chain or on-chain). Proves correctness without revealing private inputs.

  • Based on the proof / constraint logic used

  • For example, the circuit1.circom generates proof of this format

{
 "pi_a": [
  "1638329484090018111484545145134123326282976225451659760854477883805645013830",
  "2752848822609064803808122574190917007462921804832306929245310246470507673159",
  "1"
 ],
 "pi_b": [
  [
   "12928121437374283859766510658948626502569276294417251057345670634037972300681",
   "3072475294923701060398512508048631849550392927891055663937107847188429980474"
  ],
  [
   "11508245998816662493251752397385822782800620266877355492680399191829984602572",
   "3604629777497933934614151017709501267123628857660300935447784683726337949100"
  ],
  [
   "1",
   "0"
  ]
 ],
 "pi_c": [
  "15894848609843251674759956385838065880216240325475388560338119973858218893471",
  "15792043424541481373933396337759762189531409286468660893990919779800448181866",
  "1"
 ],
 "protocol": "groth16",
 "curve": "bn128"
}

Public JSON

  • Purpose: Contains only the public inputs and outputs of the circuit (used for verification). Must match what's embedded in the verifier smart contract.

  • For example:

[
 "16832421271961222550979173996485995711342823810308835997146707681980704453417"
]

Verification JSON

  • Purpose: Stores the public verification key generated during the trusted setup phase.

  • Required by snarkjs groth16 verify to verify a proof.

  • Created during snarkjs groth16 setup.

  • For example:

{
 "protocol": "groth16",
 "curve": "bn128",
 "nPublic": 1,
 "vk_alpha_1": [
  "8869605257937855253676197458013061617925059548977216455424876525978871984183",
  "11655873873540569454085997552389107993992150884314326332554681674917546920403",
  "1"
 ],
 "vk_beta_2": [
  [
   "8410363463670250691860593792029530836887327097659918293162064399086390603482",
   "12302449977203765070971398621757532493689619416634549246886874617180071853322"
  ],
  [
   "21113243572226894134432570687286188542791507918083042716855232046136002533072",
   "1963379131011487609243367443780917692422883594119439911521832757017243697483"
  ],
  [
   "1",
   "0"
  ]
 ],
 "vk_gamma_2": [
  [
   "10857046999023057135944570762232829481370756359578518086990519993285655852781",
   "11559732032986387107991004021392285783925812861821192530917403151452391805634"
  ],
  [
   "8495653923123431417604973247489272438418190587263600148770280649306958101930",
   "4082367875863433681332203403145435568316851327593401208105741076214120093531"
  ],
  [
   "1",
   "0"
  ]
 ],
 "vk_delta_2": [
  [
   "14987710377137922027846338113944051582626866994210781037332168017452633213172",
   "9950235720320126848775551935006797534543154741182374574041254533807720918931"
  ],
  [
   "4670509095194568851427958052241571837955577188000023434044126961123003363373",
   "11053778295223459501301972799877293250539127775770552413388865976412214555327"
  ],
  [
   "1",
   "0"
  ]
 ],
 "vk_alphabeta_12": [
  [
   [
    "21611421861300275333491925854432369254670756747550222007967453262164541591123",
    "3512840926037737148678380818812415960346974507481010748177562745825824736992"
   ],
   [
    "7611769212160492577052703351228011382683434153735475949761133727365667035713",
    "5618726895311558227222002035985940227163189824475809782675703154678175850848"
   ],
   [
    "18962529872022178778047209109129323061183033268828522750160130976431221677358",
    "9898331054092751610121079892236519671592210139070854075914109113505237978268"
   ]
  ],
  [
   [
    "3051891545771378439879656536020046408967014143110663238353082853362426661803",
    "18868602398068654674207329059093242927216296253571495453494499956141546313359"
   ],
   [
    "6498104172716556486069859279049618423320466470250004644547604581509479097965",
    "2820313442277147164049379046003311407851862940515165763096736930549589479316"
   ],
   [
    "7512457147105117936718219657969473129071766829949615085820908024573161254266",
    "15033266231385818418090785459645009712658383362137681871145435943389894761839"
   ]
  ]
 ],
 "IC": [
  [
   "21294129589968209158125213595778749342569279326198655837150068009092566598460",
   "19756143443697750759417125606578584112834209796873167348917873504559078198",
   "1"
  ],
  [
   "20648394678203555437888947295412974298699554498844343644897565815896436271604",
   "16548053884406546785668647213342444841584249883066072230444789596281309009649",
   "1"
  ]
 ]
}

Last updated