Skip to main content

VerificationKey

o1js / Modules / VerificationKey

Class: VerificationKey

Hierarchy

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

    VerificationKey

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new VerificationKey(value)

Parameters

NameTypeDefault value
valueObjectundefined
value.datastringString
value.hashFieldField

Inherited from

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

Defined in

lib/circuit_value.ts:367

Properties

data

data: string = String

Inherited from

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

Defined in

lib/zkapp.ts:1484


hash

hash: Field = Field

Inherited from

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

Defined in

lib/zkapp.ts:1484


_isStruct

Static _isStruct: true

Inherited from

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

Defined in

lib/circuit_value.ts:367


check

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

Type declaration

▸ (value): 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.

Parameters
NameTypeDefault valueDescription
valueObjectundefinedthe element of type T to put assertions on.
value.datastringString-
value.hashFieldField-
Returns

void

Inherited from

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

Defined in

snarky.d.ts:75


fromFields

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

Type declaration

▸ (fields, aux): Object

A function that returns an element of type T from the given provable and "auxiliary" data.

Important: For any element of type T, this function is the reverse operation of calling toFields and toAuxilary methods on an element of type T.

Parameters
NameTypeDescription
fieldsField[]an array of Field elements describing the provable data of the new T element.
auxany[]an array of any type describing the "auxiliary" data of the new T element, optional.
Returns

Object

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

NameType
datastring
hashField

Inherited from

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

Defined in

snarky.d.ts:56


fromJSON

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

Type declaration

▸ (x): Object

Parameters
NameType
xstring
Returns

Object

NameType
datastring
hashField

Inherited from

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

Defined in

lib/circuit_value.ts:375


toAuxiliary

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

Type declaration

▸ (value?): 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.

Parameters
NameTypeDefault valueDescription
value?Objectundefinedthe element of type T to generate the auxiliary data array from, optional. If not provided, a default value for auxiliary data is returned.
value.datastringString-
value.hashFieldField-
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

Defined in

snarky.d.ts:44


toFields

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

Type declaration

▸ (value): 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.

Parameters
NameTypeDefault valueDescription
valueObjectundefinedthe element of type T to generate the Field array from.
value.datastringString-
value.hashFieldField-
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

Defined in

snarky.d.ts:35


toInput

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

Type declaration

▸ (x): Object

Parameters
NameTypeDefault value
xObjectundefined
x.datastringString
x.hashFieldField
Returns

Object

NameType
fields?Field[]
packed?[Field, number][]

Inherited from

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

Defined in

lib/circuit_value.ts:370


toJSON

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

Type declaration

▸ (x): string

Parameters
NameTypeDefault value
xObjectundefined
x.datastringString
x.hashFieldField
Returns

string

Inherited from

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

Defined in

lib/circuit_value.ts:374

Methods

sizeInFields

Static sizeInFields(): number

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

Warning: This function returns a number, so you cannot use it to prove something on chain. You can use it during debugging or to understand the memory complexity of some 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

Defined in

snarky.d.ts:65