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
Name | Type | Default value |
---|---|---|
value | Object | undefined |
value.data | string | String |
value.hash | Field | Field |
Inherited from
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, }).constructor
Defined in
Properties
data
• data: string
= String
Inherited from
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, }).data
Defined in
hash
• hash: Field
= Field
Inherited from
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, }).hash
Defined in
_isStruct
▪ Static
_isStruct: true
Inherited from
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, })._isStruct
Defined in
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
Name | Type | Default value | Description |
---|---|---|---|
value | Object | undefined | the element of type T to put assertions on. |
value.data | string | String | - |
value.hash | Field | Field | - |
Returns
void
Inherited from
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, }).check
Defined in
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
Name | Type | Description |
---|---|---|
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
Object
An element of type T
generated from the given provable and "auxiliary" data.
Name | Type |
---|---|
data | string |
hash | Field |
Inherited from
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, }).fromFields
Defined in
fromJSON
▪ Static
fromJSON: (x
: string
) => { data
: string
= String; hash
: Field
= Field }
Type declaration
▸ (x
): Object
Parameters
Name | Type |
---|---|
x | string |
Returns
Object
Name | Type |
---|---|
data | string |
hash | Field |
Inherited from
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, }).fromJSON
Defined in
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
Name | Type | Default value | Description |
---|---|---|---|
value? | Object | undefined | 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 | - |
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
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
Name | Type | Default value | Description |
---|---|---|---|
value | Object | undefined | the element of type T to generate the Field array from. |
value.data | string | String | - |
value.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
Defined in
toInput
▪ Static
toInput: (x
: { data
: string
= String; hash
: Field
= Field }) => { fields?
: Field
[] ; packed?
: [Field
, number
][] }
Type declaration
▸ (x
): Object
Parameters
Name | Type | Default value |
---|---|---|
x | Object | undefined |
x.data | string | String |
x.hash | Field | Field |
Returns
Object
Name | Type |
---|---|
fields? | Field [] |
packed? | [Field , number ][] |
Inherited from
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, }).toInput
Defined in
toJSON
▪ Static
toJSON: (x
: { data
: string
= String; hash
: Field
= Field }) => string
Type declaration
▸ (x
): string
Parameters
Name | Type | Default value |
---|---|---|
x | Object | undefined |
x.data | string | String |
x.hash | Field | Field |
Returns
string
Inherited from
Struct({ ...provable({ data: String, hash: Field }), toJSON({ data }: { data: string }) { return data; }, }).toJSON
Defined in
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