Class: BTCR2MerkleTree ​
Defined in: btcr2-tree.ts:25
Convenience wrapper around OptimizedSMT that handles did:btcr2-specific index assignment, leaf hash construction, and proof serialization.
Lifecycle: addEntries() → finalize() → proof(did).
Constructors ​
Constructor ​
new BTCR2MerkleTree(
allowNonInclusion?):BTCR2MerkleTree
Defined in: btcr2-tree.ts:30
Parameters ​
allowNonInclusion? ​
boolean = true
Returns ​
BTCR2MerkleTree
Accessors ​
rootHash ​
Get Signature ​
get rootHash():
Uint8Array
Defined in: btcr2-tree.ts:69
Root hash of the finalized tree. Throws if not finalized.
Returns ​
Uint8Array
Methods ​
addEntries() ​
addEntries(
entries):void
Defined in: btcr2-tree.ts:38
Add entries to the tree. May be called multiple times before finalize. Duplicate DIDs (same index) throw.
Parameters ​
entries ​
Returns ​
void
finalize() ​
finalize():
void
Defined in: btcr2-tree.ts:58
Compute leaf hashes and finalize the tree. After this call, rootHash and proof become available.
Returns ​
void
proof() ​
proof(
did):SerializedSMTProof
Defined in: btcr2-tree.ts:77
Get the did:btcr2 serialized proof for a DID. Includes nonce and updateId metadata when available.
Parameters ​
did ​
string
Returns ​
reset() ​
reset():
void
Defined in: btcr2-tree.ts:91
Clear hashes and proofs, keeping tree structure. Entries are preserved.
Returns ​
void