Skip to main content

MerkleTreeCollapsedUpdate

For the complete documentation index, see llms.txt

@midnight/zswap v4.0.0-rc


@midnight/zswap / MerkleTreeCollapsedUpdate

Class: MerkleTreeCollapsedUpdate

A compact delta on the coin commitments Merkle tree, used to keep local spending trees in sync with the global state without requiring receiving all transactions.

Constructors​

new MerkleTreeCollapsedUpdate()​

new MerkleTreeCollapsedUpdate(
state,
start,
end): MerkleTreeCollapsedUpdate

Create a new compact update from a non-compact state, and inclusive start and end indices

Parameters​

state​

ZswapChainState

start​

bigint

end​

bigint

Returns​

MerkleTreeCollapsedUpdate

Throws​

If the indices are out-of-bounds for the state, or end < start

Methods​

serialize()​

serialize(netid): Uint8Array<ArrayBufferLike>

Parameters​

netid​

NetworkId

Returns​

Uint8Array<ArrayBufferLike>


toString()​

toString(compact?): string

Parameters​

compact?​

boolean

Returns​

string


deserialize()​

static deserialize(raw, netid): MerkleTreeCollapsedUpdate

Parameters​

raw​

Uint8Array<ArrayBufferLike>

netid​

NetworkId

Returns​

MerkleTreeCollapsedUpdate