Catalog npm
Back to packageRELEASE DETAILS

2.0.0-alpha4

npm

@0xcert/merkle

Implementation of basic functions of binary Merkle tree.

0xcertassetblockchaincurrencyerc-20erc-721ethereumframeworkfungiblejavascriptlibrariesnodejsnon-fungiblenpmnuxtjsprotocol
All keywords (23)
smart-contracttokentypescriptvaluevaluesvuejszxc
Published1 Aug 2019
Direct dependencies7
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 7

Native requirements
7 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
@0xcert/utils
Environment
{
  "local_name": "@0xcert/utils",
  "alias": false,
  "peer_metadata": null
}
2.0.0-alpha4development
@hayspec/cli
Environment
{
  "local_name": "@hayspec/cli",
  "alias": false,
  "peer_metadata": null
}
^0.8.3development
@hayspec/spec
Environment
{
  "local_name": "@hayspec/spec",
  "alias": false,
  "peer_metadata": null
}
^0.8.3development
nyc
Environment
{
  "local_name": "nyc",
  "alias": false,
  "peer_metadata": null
}
^14.1.1development
ts-node
Environment
{
  "local_name": "ts-node",
  "alias": false,
  "peer_metadata": null
}
^7.0.1development
tslint
Environment
{
  "local_name": "tslint",
  "alias": false,
  "peer_metadata": null
}
^5.12.1development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^3.1.1development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-KVrcFtRL2As1JFpem/c1zwDFflbVigrNxGwCW/bTDCNSu5oiWefuGPjVbc/bPV6ZMq7+vssqJmROKEC2c/9zPA==",
  "shasum": "1fae5bf48c56434bef3a7be3d171250fa7be8f61",
  "tarball": "https://registry.npmjs.org/@0xcert/merkle/-/merkle-2.0.0-alpha4.tgz",
  "fileCount": 36,
  "unpackedSize": 79440,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdQ0GwCRA9TVsSAnZWagAA+XoP+gIpNnHoiNu+R/h9wush\nbKVkEO7uelc7Qqo4zWsX0ZygacMkRSoSSI7+brAAORtLKwsVumEaQOOk7AIj\nIdfvZzP3xw4g5eoAN0m+c0j9WTY0EIqsQmlapWtImVzQhu3y0trwOSTOgaEN\nFQURXGmUIfQVN1aaR8DX7w0Lay82hBUulV8rzNe8fhk09SjVl8YRNwz8S+tN\nuHJlRqAoyZuPxNNIrLnJLpFBdd+WHrqtYU6ty/6OPEs4T9UTo3uiHW0j3vpE\nMBMpJceiX5u2LfcQ31MI7N6joE/PcEYNRvvDCMtNJ6KjVO/Ee1+HnKwIcZPH\n2StX62//eAY7VU18OvMdw0Ux2Feg9jJN6H5A8T2xL3Ko5b4msadDXpqAekOV\nPbRKRAEdE425I/brfo9fHoxd5Bjc9fK9bxcqyr/ljYOCIGBUWiVcI4NwhDk8\n0Ef9eAvTuu1/5ewF3pK856tEDaRwq1xUAF+2395B4I+q7GXvOz17FtA1yLWj\nJQrvM8v7m+ewGTVM66I9A5h2K98Z2Gn3uQ2OhCI+O55dC3nwFakfXeNRiE0y\nJdGg2KpN3Qf3stnWe+NkAP7QmNgadZ+HnZp6n+G5crSjAUlncfRzsRH+Igof\n6OeEaTC0aEPTVenKF5SU6xNY7vS5bbqGEKSXhO6rfsmRSpM3uV/F7rKHWTdS\nbCgL\r\n=FE7J\r\n-----END PGP SIGNATURE-----\r\n",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEUCIQDP2B3kNDkRxbcVGMiWtuuQHnSQesXCgUNoGdj62FdtKAIgEgMeehubQYGdDaVk2pjS64VAPo4qzaElVsVaWFyOclc="
    }
  ]
}

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:676580aed82b983be2fde2e935fd6ae32eb5db4165eba9bb48879e249f7d0c91

Other collected versions

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