- {
"data"
:String
;"hash"
:Field
; }
new VerificationKey(value: {
"data": String;
"hash": Field;
}): VerificationKey
• value
• value.data: string
= String
• value.hash: Field
= Field
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, }).constructor
lib/provable/types/struct.ts:148
data: string = String;
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, }).data
lib/proof-system/zkprogram.ts:545
hash: Field = Field;
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, }).hash
lib/proof-system/zkprogram.ts:545
static _isStruct: true;
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, })._isStruct
lib/provable/types/struct.ts:148
static check: (value: {
"data": String;
"hash": Field;
}) => void;
Add assertions to the proof to check if value
is a valid member of type T
.
This function does not return anything, instead it creates any number of assertions to prove that value
is a valid member of the type T
.
For instance, calling check function on the type Bool asserts that the value of the element is either 1 or 0.
• value
the element of type T
to put assertions on.
• value.data: string
= String
• value.hash: Field
= Field
void
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, }).check
lib/provable/types/provable-intf.ts:76
static empty: () => {
"data": String;
"hash": Field;
};
{
"data": String;
"hash": Field;
}
data: string = String;
hash: Field = Field;
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, }).empty
lib/provable/types/struct.ts:158
static fromFields: (fields: Field[], aux: any[]) => {
"data": String;
"hash": Field;
};
A function that returns an element of type T
from the given provable and "auxiliary" data.
This function is the reverse operation of calling toFields and toAuxilary methods on an element of type T
.
• fields: Field
[]
an array of Field elements describing the provable data of the new T
element.
• aux: any
[]
an array of any type describing the "auxiliary" data of the new T
element, optional.
{
"data": String;
"hash": Field;
}
data: string = String;
hash: Field = Field;
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, }).fromFields
lib/provable/types/provable-intf.ts:59
static fromJSON: (x: string) => {
"data": String;
"hash": Field;
};
• x: string
{
"data": String;
"hash": Field;
}
data: string = String;
hash: Field = Field;
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, }).fromJSON
lib/provable/types/struct.ts:157
static fromValue: (x: {
"data": String;
"hash": Field;
} | {
"data": String;
"hash": Field;
}) => {
"data": String;
"hash": Field;
} & (value: {
"data": String;
"hash": Field;
} | {
"data": String;
"hash": Field;
}) => {
"data": String;
"hash": Field;
};
Convert provable type from a normal JS type.
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, }).fromValue
lib/provable/types/provable-intf.ts:86
static toAuxiliary: (value?: {
"data": String;
"hash": Field;
}) => any[];
A function that takes value
(optional), an element of type T
, as argument and
returns an array of any type that make up the "auxiliary" (non-provable) data of value
.
• value?
the element of type T
to generate the auxiliary data array from, optional.
If not provided, a default value for auxiliary data is returned.
• value.data?: string
= String
• value.hash?: Field
= Field
any
[]
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, }).toAuxiliary
lib/provable/types/provable-intf.ts:47
static optional toCanonical: (x: {
"data": String;
"hash": Field;
}) => {
"data": String;
"hash": Field;
};
Optional method which transforms a provable type into its canonical representation.
This is needed for types that have multiple representations of the same underlying value, and might even not have perfect completeness for some of those representations.
An example is the ForeignField
class, which allows non-native field elements to exist in unreduced form.
The unreduced form is not perfectly complete, for example, addition of two unreduced field elements can cause a prover error.
Specific protocols need to be able to protect themselves against incomplete operations at all costs.
For example, when using actions and reducer, the reducer must be able to produce a proof regardless of the input action.
toCanonical()
converts any input into a safe form and enables us to handle cases like this generically.
Note: For most types, this method is the identity function.
The identity function will also be used when the toCanonical()
is not present on a type.
• x
• x.data: string
= String
• x.hash: Field
= Field
{
"data": String;
"hash": Field;
}
data: string = String;
hash: Field = Field;
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, }).toCanonical
lib/provable/types/provable-intf.ts:104
static toFields: (value: {
"data": String;
"hash": Field;
}) => Field[];
A function that takes value
, an element of type T
, as argument and returns
an array of Field elements that make up the provable data of value
.
• value
the element of type T
to generate the Field array from.
• value.data: string
= String
• value.hash: Field
= Field
Field
[]
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, }).toFields
lib/provable/types/provable-intf.ts:36
static toInput: (x: {
"data": String;
"hash": Field;
}) => {
"fields": Field[];
"packed": [Field, number][];
};
• x
• x.data: string
= String
• x.hash: Field
= Field
{
"fields": Field[];
"packed": [Field, number][];
}
optional fields: Field[];
optional packed: [Field, number][];
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, }).toInput
lib/provable/types/struct.ts:152
static toJSON: (x: {
"data": String;
"hash": Field;
}) => string;
• x
• x.data: string
= String
• x.hash: Field
= Field
string
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, }).toJSON
lib/provable/types/struct.ts:156
static toValue: (x: {
"data": String;
"hash": Field;
}) => {
"data": String;
"hash": Field;
};
Convert provable type to a normal JS type.
• x
• x.data: string
= String
• x.hash: Field
= Field
{
"data": String;
"hash": Field;
}
data: string = String;
hash: bigint = Field;
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, }).toValue
lib/provable/types/provable-intf.ts:81
static dummy(): Promise<VerificationKey>
Promise
<VerificationKey
>
lib/proof-system/zkprogram.ts:550
static sizeInFields(): number
Return the size of the T
type in terms of Field type, as Field is the primitive type.
number
A number
representing the size of the T
type in terms of Field type.
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, }).sizeInFields