README.md
1 2 Storage proof `circom` circuit 3 ------------------------------ 4 5 See the [README in the parent dir](../README.md) for the (draft) specification. 6 7 ### Organization of the circuit code 8 9 - `codex` - the storage proof circuit 10 - `poseidon2` - Poseidon2 hash function 11 - `lib` - general purpose, reusable circom templates ("circuit library") 12 13 In `codex`: 14 15 - `sample_cells.circom` - compute cell indices to sample, and prove those cells 16 - `single_cell.circom` - prove a single cell 17 - `merkle.circom` - Merkle inclusion proof (using our custom Merkle tree convention) 18 19 In `poseidon2` 20 21 - `poseidon2_hash.circom` - compute Poseidon2 hash with sponge construction 22 - `poseidon2_sponge.circom` - generic sponge construction 23 - `poseidon2_perm.circom` - the Poseidon2 permutation 24 - `poseidon2_compr.circom` - the compression function 25 26 In `lib`: 27 28 - `extract_bits.circom` - extract lower bits of the *standard representation* of a field element 29 - `binary_compare.circom` - compare numbers given in binary representation (the point is that they can be bigger than the field size!) 30 - `log2.circom` - circom code for computing base 2 logarithm 31 - `misc.circom` - miscellaneous helper funtions 32 33 34 ### Main component 35 36 Note: the main component is not included in the above, as it depends on the 37 parameters. You can use one of the reference input generators to create one; 38 if you want to do manually, it should look like this: 39 40 pragma circom 2.0.0; 41 include "sample_cells.circom"; 42 43 // argument conventions: 44 // SampleAndProven( maxDepth, maxLog2NSlots, blockTreeDepth, nFieldElemsPerCell, nSamples ) 45 component main {public [entropy,dataSetRoot,slotIndex]} = SampleAndProve(32, 8, 5, 67, 100); 46 47