0.4.0 May 29, 2021
0.3.2 May 29, 2021
0.3.1 May 19, 2021
0.2.3 May 19, 2021

#58 in #intermediate-representation

GPL-3.0 license

50K SLoC



This library provides the non-native field gadget for the snarkVM constraint-writing platform. The non-native field gadget can be used as a standard FieldVar, given reasonable non-native gadget parameters.

This file contains the implementation of three structs:

  • NonNativeFieldParams specifies the constraint prime field (called BaseField), the simulated prime field (called TargetField), and internal parameters searched by the Python script (see README.md).
  • NonNativeFieldVar implements the FieldVar for simulating TargetField arithmetic within BaseField.
  • NonNativeFieldMulResultVar is an intermediate representations of the result of multiplication, which is hidden from the FieldVar interface and is left for advanced users who want better performance.

The Python script mentioned above can be found in the subdirectory scripts.


~156K SLoC