flâneur — a map of the web's best reading

Templates & Components - Circom 2 Documentation

docs.circom.io · 1,234 words · saved by 1 readers

They are normally parametric on some values that must be instantiated when the template is used. The instantiation of a template is a new circuit object, which can be used to compose other circuits, so as part of larger circuits. Since templates define circuits by instantiation, they have their own signals 𝑖 𝑛 𝑝 𝑢 𝑡 , 𝑜 𝑢 𝑡 𝑝 𝑢 𝑡 , 𝑒 𝑡 𝑐 . Templates cannot include local functions or template definitions. Assigning a value to an input signal inside the same template where it has been defined also generates the error "Exception caused by invalid assignment" as can be seen in the next example. The instantiation of a template is made using the keyword component and by providing the necessary parameters. The values of the parameters should be known constants at compile time. The next code produces this compilation error message: "Every component instantiation must be resolved during the constraint generation phase". A component defines an arithmetic circuit and, as such, it r

Templates & Components Templates The mechanism to create generic circuits in Circom is the so-called templates. They are normally parametric on some values that must be instantiated when the template is used. The instantiation of a template is a new circuit object, which can be used to compose other circuits, so as part of larger circuits. Since templates define circuits by instantiation, they have their own signals \(input, output, etc\) . template tempid ( param_1, ... , param_n ) { signal input a; signal output b; ..... } Templates cannot include local functions or template definitions. Ass

Explore this link on the map →

related reading