Catalog npm
Back to packageRELEASE DETAILS

0.0.0-init

npm

@0xcert/merkle

```ts // VERIFICATION EXAMPLE // I share an evidence file that proofs certain JSON paths (e.g. public JSON) // I have an object with just some data. // The function recreates a recipe for this partial data object and assignes is to the evidence file. // A

0xcertassetblockchaincurrencyerc-20erc-721ethereumframeworkfungiblejavascriptlibrariesnodejsnon-fungiblenpmnuxtjsprotocol
All keywords (23)
smart-contracttokentypescriptvaluevaluesvuejszxc
Published20 Nov 2018
Direct dependencies0
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 0

Native requirements
0 direct targetsNot calculated transitive count
No declared dependencies in this collected response

Declarations describe requirements; they are not a resolved dependency graph.

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-xvbC+6hPohFv9u6kwKRcIjNMlQn3yId3aHNb3p3nABYo2ebEYgsY+1Mu9k3HS3JOB4P4MtXzwO7TB18sj5sZOg==",
  "shasum": "0c270d4a00aa4aa70f41325750b44bf5ad6254d1",
  "tarball": "https://registry.npmjs.org/@0xcert/merkle/-/merkle-0.0.0-init.tgz",
  "fileCount": 16,
  "unpackedSize": 27286,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb9F/9CRA9TVsSAnZWagAAFiUP/i14GoKx/3+cDRwm+lcY\npIL4d1Q3BzFU4uPCs4rKAFqWD+YCY3wH7LLaL7VDGFkh0PTX/Z2jg7ZYv8hJ\nfri6cULncGZqw3P9aQqHq3mq34ksb52WIWYUXh5+sI2I5kqgLU5ryxvwA2wK\nbF9r9F5sCgoVHpsp60fkldnUv9RX7YVmbvO5nhX6y1HzXRUQpk6c+R8FgPTx\nhnbb9sVsGz84LaFcgSMRFeNRvwyfHmAesCUiILFb8f+ualtoSpqGs+rhwDjM\nIwBBjPXdL3IFoXDVEmJaa8wWJrXHGNyBl6+pDT9n9kxZJAz1MouLjZS4Rwnu\nFtIs4EKmH6TnoFCwfUNdiHh1L7kwxM2jCTy7meIrWvlfoA0ZM4lNDNovcPPB\nkyjx0+HOGZa3tomdrwPeyq/II8J52a6in7IfRe8E2KZW6Ch9tY6OyA/bESHt\nuPBUge/zTsXnxklisuYC1pfw3YE7ejGMNFOP0Akzv/y8QgkjxXjNU2GgLX7w\nwMtnNOf00wuUw0zwRUVOLgFpr1SaL0oLUV/+HDKX/I2CAg6rJLS4BgV56Q9I\nzDIkkNSebKPgjD3Q3VJzOiWBCK/uLmeQsxBVRM5K8kmgoEmDYaxBdQ479IFe\nmzTOHuwkMHzAi/ioNZGRp6kZMqBXIDx8byLucOAKJXVyrZa8yhafn2RlJeD4\n9nRg\r\n=/V6X\r\n-----END PGP SIGNATURE-----\r\n",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEUCIQDHdYveqVUyLEvsp7vf77iOr7v3m8XIgUlbIhJz5BYHZwIgDGX5z7nAW2F+Y4xwY76PuxagjQZngQ6lHSOzYde1Otw="
    }
  ]
}

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:522e95adc755b46e218b4c36dbf25f4152f174f26dbbec68cb072cc94fe4f54e

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 →