Zeth - Zerocash on Ethereum
0.8
Reference implementation of the Zeth protocol by Clearmatics
|
Functions | |
def | get_index (annotation_set, annotation) |
def | get_constraints (constraints_set, annotation_index) |
def | get_constraints_from_annotation_pattern (constraints_set, annotation_pattern) |
def | is_in_lin_comb (linear_combination, annotation_index) |
Variables | |
path_zeth = os.environ["ZETH_DEBUG_DIR"] | |
string | filename = "r1cs.json" |
file_path = os.path.join(path_zeth, filename) | |
data = r1cs_file.read() | |
r1cs_obj = json.loads(data) | |
r1cs_variables_nb = r1cs_obj["num_variables"] | |
r1cs_constraints_nb = r1cs_obj["num_constraints"] | |
variables_annotations_set = r1cs_obj["variables_annotations"] | |
constraints_set = r1cs_obj["constraints"] | |
string | annotation_to_check = "joinsplit_gadget phi bits_31" |
def | annotation_index = get_index(variables_annotations_set, annotation_to_check) |
def | constraints_using_annotation = get_constraints(constraints_set, annotation_index) |
string | regex = "rho" |
def | res = get_constraints_from_annotation_pattern(constraints_set, regex) |
def analyzer.parse_r1cs.get_constraints | ( | constraints_set, | |
annotation_index | |||
) |
Returns the set of constraints in which a given wire figures (wire = index of a variable annotation) The set of constraints has the structure below: "constraints": [ { "constraint_id": ID, "constraint_annotation": ANNOTATION "linear_combination": { # `index:` Index of the wire/variable # `value:` Scalar by which the wire value is multiplied # by in the linear combination A "A": [ { "index": "0", "value": "0x1" } ], "B": [ { "index": "530", "scalar": "0x1" }, { "index": "531", "scalar": "0x2" }, { "index": "532", "scalar": "0x4" } ], "C": [ { "index": "2", "scalar": "0x1" } ] } } ]
Definition at line 31 of file parse_r1cs.py.
def analyzer.parse_r1cs.get_constraints_from_annotation_pattern | ( | constraints_set, | |
annotation_pattern | |||
) |
Returns a set of constraints which annotation matches the given pattern. The regex is given by the user (which can be quite dangerous but the goal of this script is not to be robust anyway)
Definition at line 77 of file parse_r1cs.py.
def analyzer.parse_r1cs.get_index | ( | annotation_set, | |
annotation | |||
) |
Finds the index corresponding to `annotation` in the annotation set (which has the structure below) "variables_annotations": [ { "index": INDEX, "annotation": ANNOTATION }, ... { "index": INDEX, "annotation": ANNOTATION } ]
Definition at line 11 of file parse_r1cs.py.
def analyzer.parse_r1cs.is_in_lin_comb | ( | linear_combination, | |
annotation_index | |||
) |
Inspects all the elements of the linear combination and returns true is the variable corresponding to the annotation_index is used in the linear combination
Definition at line 96 of file parse_r1cs.py.
def analyzer.parse_r1cs.annotation_index = get_index(variables_annotations_set, annotation_to_check) |
Definition at line 134 of file parse_r1cs.py.
string analyzer.parse_r1cs.annotation_to_check = "joinsplit_gadget phi bits_31" |
Definition at line 133 of file parse_r1cs.py.
analyzer.parse_r1cs.constraints_set = r1cs_obj["constraints"] |
Definition at line 127 of file parse_r1cs.py.
def analyzer.parse_r1cs.constraints_using_annotation = get_constraints(constraints_set, annotation_index) |
Definition at line 139 of file parse_r1cs.py.
analyzer.parse_r1cs.data = r1cs_file.read() |
Definition at line 116 of file parse_r1cs.py.
Definition at line 114 of file parse_r1cs.py.
string analyzer.parse_r1cs.filename = "r1cs.json" |
Definition at line 111 of file parse_r1cs.py.
analyzer.parse_r1cs.path_zeth = os.environ["ZETH_DEBUG_DIR"] |
Definition at line 110 of file parse_r1cs.py.
analyzer.parse_r1cs.r1cs_constraints_nb = r1cs_obj["num_constraints"] |
Definition at line 121 of file parse_r1cs.py.
analyzer.parse_r1cs.r1cs_obj = json.loads(data) |
Definition at line 119 of file parse_r1cs.py.
analyzer.parse_r1cs.r1cs_variables_nb = r1cs_obj["num_variables"] |
Definition at line 120 of file parse_r1cs.py.
string analyzer.parse_r1cs.regex = "rho" |
Definition at line 142 of file parse_r1cs.py.
def analyzer.parse_r1cs.res = get_constraints_from_annotation_pattern(constraints_set, regex) |
Definition at line 144 of file parse_r1cs.py.
analyzer.parse_r1cs.variables_annotations_set = r1cs_obj["variables_annotations"] |
Definition at line 126 of file parse_r1cs.py.