Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/lucid/src/mod.ts>MerkleTree

Lucid is a library, which allows you to create Cardano transactions and off-chain code for your Plutus contracts in JavaScript, Deno and Node.js.
Go to Latest
class MerkleTree
import { MerkleTree } from "https://deno.land/x/lucid@0.10.6/src/mod.ts";

Constructors

new
MerkleTree(data: Array<Uint8Array>)

Construct Merkle tree from data, which get hashed with sha256

Properties

root: MerkleNode | null

Methods

getProof(data: Uint8Array): MerkleTreeProof
rootHash(): Hash
size(): number
toString(): string

Static Methods

private
buildRecursively(hashes: Array<Hash>): MerkleNode | null
fromHashes(hashes: Array<Hash>)

Construct Merkle tree from sha256 hashes

verify(
data: Uint8Array,
rootHash: Hash,
proof: MerkleTreeProof,
): boolean