Catalog npm
Back to packageRELEASE DETAILS

2.0.3

npm

@0xcert/merkle

Implementation of basic functions of binary Merkle tree.

0xcertassetblockchaincurrencyerc-20erc-721ethereumframeworkfungiblejavascriptlibrariesnodejsnon-fungiblenpmnuxtjsprotocol
All keywords (23)
smart-contracttokentypescriptvaluevaluesvuejszxc
Published12 Aug 2020
Direct dependencies13
Transitive dependenciesNot calculated

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.

Declared dependencies 13

Native requirements
13 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
@0xcert/utils
Environment
{
  "local_name": "@0xcert/utils",
  "alias": false,
  "peer_metadata": null
}
2.0.3development
@hayspec/cli
Environment
{
  "local_name": "@hayspec/cli",
  "alias": false,
  "peer_metadata": null
}
0.10.0development
@hayspec/spec
Environment
{
  "local_name": "@hayspec/spec",
  "alias": false,
  "peer_metadata": null
}
0.10.0development
nyc
Environment
{
  "local_name": "nyc",
  "alias": false,
  "peer_metadata": null
}
15.1.0development
ts-node
Environment
{
  "local_name": "ts-node",
  "alias": false,
  "peer_metadata": null
}
8.10.2development
@typescript-eslint/eslint-plugin
Environment
{
  "local_name": "@typescript-eslint/eslint-plugin",
  "alias": false,
  "peer_metadata": null
}
3.9.0development
@typescript-eslint/parser
Environment
{
  "local_name": "@typescript-eslint/parser",
  "alias": false,
  "peer_metadata": null
}
3.9.0development
eslint-config-prettier
Environment
{
  "local_name": "eslint-config-prettier",
  "alias": false,
  "peer_metadata": null
}
6.11.0development
eslint-plugin-import
Environment
{
  "local_name": "eslint-plugin-import",
  "alias": false,
  "peer_metadata": null
}
2.22.0development
eslint-plugin-jsdoc
Environment
{
  "local_name": "eslint-plugin-jsdoc",
  "alias": false,
  "peer_metadata": null
}
30.2.1development
eslint-plugin-unicorn
Environment
{
  "local_name": "eslint-plugin-unicorn",
  "alias": false,
  "peer_metadata": null
}
21.0.0development
eslint
Environment
{
  "local_name": "eslint",
  "alias": false,
  "peer_metadata": null
}
7.6.0development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
3.9.7development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-DXYtXRvRYdLfruS90bWFLJ/01p60gbeSLRMcMsLusdSNjJgar5yhsjMZYM+auUrLQiBL9yd6E92tnA6/UpMX1A==",
  "shasum": "8295250108e061fca3343472a340ac77f9278819",
  "tarball": "https://registry.npmjs.org/@0xcert/merkle/-/merkle-2.0.3.tgz",
  "fileCount": 37,
  "unpackedSize": 96033,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfM+bjCRA9TVsSAnZWagAAdrQP/jZB6eaUJm3gRC+0DkRD\nwUxOTefV3RvIcA3w7DqSNqhy0QDX1t3YoCvLZy7zvFGBKWasIgy+vGjivt9b\nYn0GfLtxyz7imSPGI2sFTGPZ/vQBeUlVQ2Dp7jXNVJzY9l1ijvJ33FRw/1ts\ncKpOi+u3jTI8S+2vi/soQNUn8m9xNj1Ri6UGfy1gMYY8FTmZIvLzYppVKDWo\nxM287IVmq20BDbwJneKg6JNpc4k5NIAp/nRK/cenGnEVg2AToMWwCzxBekz0\n/f9sDTY7akZA+mXX+7u7uZW6qF3Db9t2gsvavuCFxmfvaLznBMjVi+cy7X28\n/c9IqEc7qzv5iv5MXEGxhKOJBFz8dCDpkZK8p0OIkygukFk+7hfUgWlfndXV\nW9CGHGcM24piMEINhjOqLoWwm1XIpEq3/EeNpOa5TUiGwdBn9Zqvn/pqlR3F\nj9ytVYm/ZfRoPtWnghXIrycBCnTogiIQ+I0MrNaXEGG4i5L/quNDRJGxXxek\nwvDRM7+LTWQ4Uz1NDp8024aRfaqWX+Wp+Se0uipKtxn0A6md7rIrOIh9DM7s\ntXGV0C4BZfA79PESXXktIakR+9gndt16DnJhMzO+S4gsu88vzYuvd6vdIvx7\n8jNupzA36dj+VRT8ppGK9hEiUGNykxOHCBsr7mHWyWJpn/E4GAGV6++OaLZ3\njwIt\r\n=vbR2\r\n-----END PGP SIGNATURE-----\r\n",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEUCICG7LOO8/+EHXV4kDP7/m3YjnKzqfiIVAv0JYoQtcutBAiEAnD1mpzls2ExfA4D1N1IQRmjXk5DLHANBDTwCv56DZcI="
    }
  ]
}

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_version:7e9de2eaefe8d61e4b6de28ff531c9c8c9dcfd5235eab0e63a145b6d16be7417

Other collected versions

2.1.115 Mar2.1.014 Jan2.0.24 May2.0.16 Mar2.0.1-beta05 Mar2.0.02 MarView all collected versions →