Catalog npm
Back to packageRELEASE DETAILS

2.0.0-beta

npm

@0xcert/merkle

Implementation of basic functions of binary Merkle tree.

0xcertassetblockchaincurrencyerc-20erc-721ethereumframeworkfungiblejavascriptlibrariesnodejsnon-fungiblenpmnuxtjsprotocol
All keywords (23)
smart-contracttokentypescriptvaluevaluesvuejszxc
Published17 Jan 2020
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-betadevelopment
@hayspec/cli
Environment
{
  "local_name": "@hayspec/cli",
  "alias": false,
  "peer_metadata": null
}
0.9.0development
@hayspec/spec
Environment
{
  "local_name": "@hayspec/spec",
  "alias": false,
  "peer_metadata": null
}
0.9.0development
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
}
8.4.1development
tslint
Environment
{
  "local_name": "tslint",
  "alias": false,
  "peer_metadata": null
}
5.20.0development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
3.6.3development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-7S9TBjQ8dY/1wyFLw+nZ4KDfwUduu8785JFaUwT+9kY+7ZuH3i0aN4s/0Moni88GCEQvqy3HGi+F5dsAC3ddUQ==",
  "shasum": "35e109f6b404720772314fe09fb8a95003b07ac6",
  "tarball": "https://registry.npmjs.org/@0xcert/merkle/-/merkle-2.0.0-beta.tgz",
  "fileCount": 37,
  "unpackedSize": 81878,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeIXjYCRA9TVsSAnZWagAAc/IP/RXNITcVl9iL/9pGN4ey\nKpYrkrj4E8E0EPJIti++Sm7qNoYkZY6QrfMruQqnD+7Nd+TyVbqSq2Gcgki+\nYWeOlerv4KTiW+1RipCgbXOjXcYXdqirxHKkPl7MoCvjtByYH8RzivKsWm1U\nmOz366Lf/oF4jrXN6W6fpUp95l1EkMWn8IWUIULFyRYDZQGp8Q0Ziotp/EZi\nptacYS8s9z2oM9d9lKxBM26BPAFIChCovCbt1Ro6ZWhu9+k8aocmmnH91UrQ\nIX1uYtZeHkHG7mBcJdfBs3xoQg/WQF5udV9PrlP+Ls4aiXkZDh7rLG/vWPfP\nPcjdPowK3Yj6aiL+wk9haKxBUq3Nx0H2e/BGp7ZE3kprAggpOZhmOjEbarYn\nyNW8riSRhOy7+eEq3Ozt31xPs6R4ojbBchpnLZbyUQqJwNzoyoYJYdZZBqwq\n5G3kGPe9gig9fQkcRZKfS0UZmhQV9SASpNUIrXStEZXGJCilyvvuxD+YNOgi\n9DvSa8HQ9f7RMQBxhKel7cnEuHN0Ba3B/WXiZndVQZv6/kQg0UPhyhi+v5cq\nyoSAtkYOWRDX2cwLsF7RxdN0g9xLUlHXjTZCU6doPj5sAYcfSs+Kme5u05ZF\nwyMDFjr5uxMcSHcQbqisP997Qc8cYsoBtC/mG/9ftX+GiF3wQgJxES8HQeTQ\nRbtT\r\n=hKe2\r\n-----END PGP SIGNATURE-----\r\n",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEUCIGJYQ2n5hy71/lfsAP3By/sx2xxtWwIeOyMeV9+hXEiUAiEAwq9RA/2G4FVLAE3Jdxym3SPD+rpaQDggCC2e/2sLYxc="
    }
  ]
}

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:6079259b751e15f6b77e8e4d65c0b2bc2c5b1146de1b25506cbe5d0735abc53e

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 →