Skip to main content
Version: 2.4.0

VerificationKey

Defined in: lib/proof-system/verification-key.ts:8

Extends

  • { data: string; hash: Field; }

Constructors

new VerificationKey()

new VerificationKey(value: {
data: string;
hash: Field;
}): VerificationKey

Defined in: lib/provable/types/struct.ts:133

Parameters

value
data

string = String

hash

Field = Field

Returns

VerificationKey

Inherited from

Struct({
...provable({ data: String, hash: Field }),
toJSON({ data }: { data: string }) {
return data;
},
}).constructor

Properties

data

data: string = String;

Defined in: lib/proof-system/verification-key.ts:9

Inherited from

Struct({
...provable({ data: String, hash: Field }),
toJSON({ data }: { data: string }) {
return data;
},
}).data

hash

hash: Field = Field;

Defined in: lib/proof-system/verification-key.ts:9

Inherited from

Struct({
...provable({ data: String, hash: Field }),
toJSON({ data }: { data: string }) {
return data;
},
}).hash

_isStruct

static _isStruct: true;

Defined in: lib/provable/types/struct.ts:133

Inherited from

Struct({
...provable({ data: String, hash: Field }),
toJSON({ data }: { data: string }) {
return data;
},
})._isStruct

check()

static check: (value: {
data: string;
hash: Field;
}) => void;

Defined in: lib/provable/types/provable-intf.ts:76

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.

Parameters

value

the element of type T to put assertions on.

data

string = String

hash

Field = Field

Returns

void

Inherited from

Struct({
...provable({ data: String, hash: Field }),
toJSON({ data }: { data: string }) {
return data;
},
}).check

empty()

static empty: () => {
data: string;
hash: Field;
};

Defined in: lib/provable/types/struct.ts:143

Returns

{
data: string;
hash: Field;
}
data
data: string = String;
hash
hash: Field = Field;

Inherited from

Struct({
...provable({ data: String, hash: Field }),
toJSON({ data }: { data: string }) {
return data;
},
}).empty

fromFields()

static fromFields: (fields: Field[], aux: any[]) => {
data: string;
hash: Field;
};

Defined in: lib/provable/types/provable-intf.ts:59

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 toAuxiliary methods on an element of type T.

Parameters

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.

Returns

{
data: string;
hash: Field;
}

An element of type T generated from the given provable and "auxiliary" data.

data
data: string = String;
hash
hash: Field = Field;

Inherited from

Struct({
...provable({ data: String, hash: Field }),
toJSON({ data }: { data: string }) {
return data;
},
}).fromFields

fromJSON()

static fromJSON: (x: string) => {
data: string;
hash: Field;
};

Defined in: lib/provable/types/struct.ts:142

Parameters

x

string

Returns

{
data: string;
hash: Field;
}
data
data: string = String;
hash
hash: Field = Field;

Inherited from

Struct({
...provable({ data: String, hash: Field }),
toJSON({ data }: { data: string }) {
return data;
},
}).fromJSON

fromValue

static fromValue: (x: 
| {
data: string;
hash: Field;
}
| {
data: string;
hash: bigint;
}) => {
data: string;
hash: Field;
} & (value:
| {
data: string;
hash: Field;
}
| {
data: string;
hash: bigint;
}) => {
data: string;
hash: Field;
};

Defined in: lib/provable/types/provable-intf.ts:86

Convert provable type from a normal JS type.

Inherited from

Struct({
...provable({ data: String, hash: Field }),
toJSON({ data }: { data: string }) {
return data;
},
}).fromValue

toAuxiliary()

static toAuxiliary: (value?: {
data: string;
hash: Field;
}) => any[];

Defined in: lib/provable/types/provable-intf.ts:47

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.

Parameters

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.

data

string = String

hash

Field = Field

Returns

any[]

An array of any type describing how this T element is made up of "auxiliary" (non-provable) data.

Inherited from

Struct({
...provable({ data: String, hash: Field }),
toJSON({ data }: { data: string }) {
return data;
},
}).toAuxiliary

toCanonical()?

static optional toCanonical: (x: {
data: string;
hash: Field;
}) => {
data: string;
hash: Field;
};

Defined in: lib/provable/types/provable-intf.ts:104

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.

Parameters

x
data

string = String

hash

Field = Field

Returns

{
data: string;
hash: Field;
}
data
data: string = String;
hash
hash: Field = Field;

Inherited from

Struct({
...provable({ data: String, hash: Field }),
toJSON({ data }: { data: string }) {
return data;
},
}).toCanonical

toFields()

static toFields: (value: {
data: string;
hash: Field;
}) => Field[];

Defined in: lib/provable/types/provable-intf.ts:36

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.

Parameters

value

the element of type T to generate the Field array from.

data

string = String

hash

Field = Field

Returns

Field[]

A Field array describing how this T element is made up of Field elements.

Inherited from

Struct({
...provable({ data: String, hash: Field }),
toJSON({ data }: { data: string }) {
return data;
},
}).toFields

toInput()

static toInput: (x: {
data: string;
hash: Field;
}) => {
fields: Field[];
packed: [Field, number][];
};

Defined in: lib/provable/types/struct.ts:137

Parameters

x
data

string = String

hash

Field = Field

Returns

{
fields: Field[];
packed: [Field, number][];
}
fields?
optional fields: Field[];
packed?
optional packed: [Field, number][];

Inherited from

Struct({
...provable({ data: String, hash: Field }),
toJSON({ data }: { data: string }) {
return data;
},
}).toInput

toJSON()

static toJSON: (x: {
data: string;
hash: Field;
}) => string;

Defined in: lib/provable/types/struct.ts:141

Parameters

x
data

string = String

hash

Field = Field

Returns

string

Inherited from

Struct({
...provable({ data: String, hash: Field }),
toJSON({ data }: { data: string }) {
return data;
},
}).toJSON

toValue()

static toValue: (x: {
data: string;
hash: Field;
}) => {
data: string;
hash: bigint;
};

Defined in: lib/provable/types/provable-intf.ts:81

Convert provable type to a normal JS type.

Parameters

x
data

string = String

hash

Field = Field

Returns

{
data: string;
hash: bigint;
}
data
data: string = String;
hash
hash: bigint = Field;

Inherited from

Struct({
...provable({ data: String, hash: Field }),
toJSON({ data }: { data: string }) {
return data;
},
}).toValue

Methods

dummy()

static dummy(): Promise<VerificationKey>

Defined in: lib/proof-system/verification-key.ts:14

Returns

Promise<VerificationKey>


dummySync()

static dummySync(): VerificationKey

Defined in: lib/proof-system/verification-key.ts:23

Returns

VerificationKey


sizeInFields()

static sizeInFields(): number

Defined in: lib/provable/types/provable-intf.ts:66

Return the size of the T type in terms of Field type, as Field is the primitive type.

Returns

number

A number representing the size of the T type in terms of Field type.

Inherited from

Struct({
...provable({ data: String, hash: Field }),
toJSON({ data }: { data: string }) {
return data;
},
}).sizeInFields