Catalog npm
PACKAGE EXPLORERView in registry

@0xcert/merkle

npm

Implementation of basic functions of binary Merkle tree.

0xcertassetblockchaincurrencyerc-20erc-721ethereumframeworkfungiblejavascriptlibrariesnodejsnon-fungiblenpmnuxtjsprotocol
All keywords (23)
smart-contracttokentypescriptvaluevaluesvuejszxc
Versions collected76
Direct dependencies13From release 2.1.1
Last observed20 Oct, 22:48 UTC

README

Current package documentation

Implementation of basic functions of a binary Merkle tree.

This module handles binary trees like this (v = value, n = node, r = nonce):

       n0
       |
   ---------
   |       |
   n1      n2
   |       |
|-----|    |
v0    r0   |
      ---------
      |       |
      n3      n4
      |       |
   |-----|    |
   v1    r1   r2

A user defines an array of values where these values are hashed into an imprint, which is a Merkle root tree hash. A user can expose selected values to a third-party by providing the evidence file which includes a recipe of values and nodes. This file holds enough information for a third-party to recreate the imprint.

import { sha } from '@0xcert/utils'; 
import { Merkle } from '@0xcert/merkle'; 

const merkle = new Merkle({
  hasher: (v, p, k) => sha(256, v),
  noncer: (p) => Math.random().toString(36).substring(7),
});
const values = ['A', 'B', 'C', 'D', 'E'];
const expose = [2, 3];
const fullRecipe = await merkle.notarize(values);
const minRecipe = await merkle.disclose(fullRecipe, expose);
const imprint = await merkle.imprint(minRecipe);

The 0xcert Framework is a free and open-source JavaScript library that provides tools for building powerful decentralized applications. Please refer to the official documentation for more details.

This module is one of the bricks of the 0xcert Framework. It's written with TypeScript and it's actively maintained. The source code is available on GitHub where you can also find our issue tracker.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 76

Collected releases
VersionPublishedDirect dependenciesOpen version
2.1.1Registry latest15 Mar 202113
2.1.014 Jan 202113
2.0.312 Aug 202013
2.0.24 May 20207
2.0.16 Mar 20207
2.0.1-beta05 Mar 20207
2.0.02 Mar 20207
2.0.0-beta522 Feb 20207
2.0.0-beta419 Feb 20207
2.0.0-beta35 Feb 20207
2.0.0-beta230 Jan 20207
2.0.0-beta120 Jan 20207
2.0.0-beta17 Jan 20207
2.0.0-alpha1714 Jan 20207
2.0.0-alpha1613 Jan 20207
2.0.0-alpha158 Jan 20207
2.0.0-alpha1412 Dec 20197
2.0.0-alpha136 Dec 20197
2.0.0-alpha1229 Nov 20197
2.0.0-alpha116 Nov 20197

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
0xcert/framework

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 22:48 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:630d1b966472cb9c43828a0c3107b55bda0858ae22fb8849da006044eab14534