@proto-kit/protocol • Docs
Documentation / @proto-kit/protocol / BlockHashMerkleTreeWitness
Class: BlockHashMerkleTreeWitness
Extends
Constructors
new BlockHashMerkleTreeWitness()
new BlockHashMerkleTreeWitness(
value):BlockHashMerkleTreeWitness
Parameters
• value
• value.isLeft: Bool[]
• value.path: Field[]
Returns
Inherited from
BlockHashMerkleTree.WITNESS.constructor
Defined in
packages/common/dist/trees/sparse/RollupMerkleTree.d.ts:9
Properties
isLeft
isLeft:
Bool[]
Inherited from
BlockHashMerkleTree.WITNESS.isLeft
Defined in
packages/common/dist/trees/sparse/RollupMerkleTree.d.ts:14
path
path:
Field[]
Inherited from
BlockHashMerkleTree.WITNESS.path
Defined in
packages/common/dist/trees/sparse/RollupMerkleTree.d.ts:13
_isStruct
static_isStruct:true
Inherited from
BlockHashMerkleTree.WITNESS._isStruct
Defined in
packages/common/dist/trees/sparse/RollupMerkleTree.d.ts:16
check()
staticcheck: (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
• value
the element of type T to put assertions on.
• value.isLeft: Bool[]
• value.path: Field[]
Returns
void
Inherited from
BlockHashMerkleTree.WITNESS.check
Defined in
node_modules/o1js/dist/node/lib/provable/types/provable-intf.d.ts:60
dummy()
staticdummy: () =>AbstractMerkleWitness
Returns
Inherited from
BlockHashMerkleTree.WITNESS.dummy
Defined in
packages/common/dist/trees/sparse/RollupMerkleTree.d.ts:126
empty()
staticempty: () =>object
Returns
object
isLeft
isLeft:
Bool[]
path
path:
Field[]
Inherited from
BlockHashMerkleTree.WITNESS.empty
Defined in
packages/common/dist/trees/sparse/RollupMerkleTree.d.ts:57
fromFields()
staticfromFields: (fields) =>object
Parameters
• fields: Field[]
Returns
object
isLeft
isLeft:
Bool[]
path
path:
Field[]
Inherited from
BlockHashMerkleTree.WITNESS.fromFields
Defined in
packages/common/dist/trees/sparse/RollupMerkleTree.d.ts:24
fromJSON()
staticfromJSON: (x) =>object
Parameters
• x
• x.isLeft: boolean[]
• x.path: string[]
Returns
object
isLeft
isLeft:
Bool[]
path
path:
Field[]
Inherited from
BlockHashMerkleTree.WITNESS.fromJSON
Defined in
packages/common/dist/trees/sparse/RollupMerkleTree.d.ts:50
fromValue
staticfromValue: (x) =>object& (value) =>object
Convert provable type from a normal JS type.
Inherited from
BlockHashMerkleTree.WITNESS.fromValue
Defined in
node_modules/o1js/dist/node/lib/provable/types/provable-intf.d.ts:68
toAuxiliary()
statictoAuxiliary: (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
• 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.isLeft?: Bool[]
• value.path?: Field[]
Returns
any[]
An array of any type describing how this T element is made up of “auxiliary” (non-provable) data.
Inherited from
BlockHashMerkleTree.WITNESS.toAuxiliary
Defined in
node_modules/o1js/dist/node/lib/provable/types/provable-intf.d.ts:34
toCanonical()?
staticoptionaltoCanonical: (x) =>object
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
• x.isLeft: Bool[]
• x.path: Field[]
Returns
object
isLeft
isLeft:
Bool[]
path
path:
Field[]
Inherited from
BlockHashMerkleTree.WITNESS.toCanonical
Defined in
node_modules/o1js/dist/node/lib/provable/types/provable-intf.d.ts:85
toFields()
statictoFields: (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
• value
the element of type T to generate the Field array from.
• value.isLeft: Bool[]
• value.path: Field[]
Returns
Field[]
A Field array describing how this T element is made up of Field elements.
Inherited from
BlockHashMerkleTree.WITNESS.toFields
Defined in
node_modules/o1js/dist/node/lib/provable/types/provable-intf.d.ts:24
toInput()
statictoInput: (x) =>object
Parameters
• x
• x.isLeft: Bool[]
• x.path: Field[]
Returns
object
fields?
optionalfields:Field[]
packed?
optionalpacked: [Field,number][]
Inherited from
BlockHashMerkleTree.WITNESS.toInput
Defined in
packages/common/dist/trees/sparse/RollupMerkleTree.d.ts:36
toJSON()
statictoJSON: (x) =>object
Parameters
• x
• x.isLeft: Bool[]
• x.path: Field[]
Returns
object
isLeft
isLeft:
boolean[]
path
path:
string[]
Inherited from
BlockHashMerkleTree.WITNESS.toJSON
Defined in
packages/common/dist/trees/sparse/RollupMerkleTree.d.ts:43
toValue()
statictoValue: (x) =>object
Convert provable type to a normal JS type.
Parameters
• x
• x.isLeft: Bool[]
• x.path: Field[]
Returns
object
isLeft
isLeft:
boolean[]
path
path:
bigint[]
Inherited from
BlockHashMerkleTree.WITNESS.toValue
Defined in
node_modules/o1js/dist/node/lib/provable/types/provable-intf.d.ts:64
Methods
calculateIndex()
calculateIndex():
Field
Calculates the index of the leaf node that belongs to this Witness.
Returns
Field
Index of the leaf.
Inherited from
BlockHashMerkleTree.WITNESS.calculateIndex
Defined in
packages/common/dist/trees/sparse/RollupMerkleTree.d.ts:77
calculateRoot()
calculateRoot(
hash):Field
Calculates a root depending on the leaf value.
Parameters
• hash: Field
Value of the leaf node that belongs to this Witness.
Returns
Field
The calculated root.
Inherited from
BlockHashMerkleTree.WITNESS.calculateRoot
Defined in
packages/common/dist/trees/sparse/RollupMerkleTree.d.ts:71
calculateRootIncrement()
calculateRootIncrement(
index,leaf): [Field,AbstractMerkleWitness]
Parameters
• index: Field
• leaf: Field
Returns
[Field, AbstractMerkleWitness]
Inherited from
BlockHashMerkleTree.WITNESS.calculateRootIncrement
Defined in
packages/common/dist/trees/sparse/RollupMerkleTree.d.ts:72
checkMembership()
checkMembership(
root,key,value):Bool
Parameters
• root: Field
• key: Field
• value: Field
Returns
Bool
Inherited from
BlockHashMerkleTree.WITNESS.checkMembership
Defined in
packages/common/dist/trees/sparse/RollupMerkleTree.d.ts:78
checkMembershipGetRoots()
checkMembershipGetRoots(
root,key,value): [Bool,Field,Field]
Parameters
• root: Field
• key: Field
• value: Field
Returns
[Bool, Field, Field]
Inherited from
BlockHashMerkleTree.WITNESS.checkMembershipGetRoots
Defined in
packages/common/dist/trees/sparse/RollupMerkleTree.d.ts:80
checkMembershipSimple()
checkMembershipSimple(
root,value):Bool
Parameters
• root: Field
• value: Field
Returns
Bool
Inherited from
BlockHashMerkleTree.WITNESS.checkMembershipSimple
Defined in
packages/common/dist/trees/sparse/RollupMerkleTree.d.ts:79
height()
height():
number
Returns
number
Inherited from
BlockHashMerkleTree.WITNESS.height
Defined in
packages/common/dist/trees/sparse/RollupMerkleTree.d.ts:65
toShortenedEntries()
toShortenedEntries():
string[]
Returns
string[]
Inherited from
BlockHashMerkleTree.WITNESS.toShortenedEntries
Defined in
packages/common/dist/trees/sparse/RollupMerkleTree.d.ts:81
sizeInFields()
staticsizeInFields():number
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
BlockHashMerkleTree.WITNESS.sizeInFields
Defined in
node_modules/o1js/dist/node/lib/provable/types/provable-intf.d.ts:51