2.1.1 • Published 2 years ago

@0xcert/merkle v2.1.1

Weekly downloads
2,747
License
MIT
Repository
github
Last release
2 years ago

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.

2.1.1

2 years ago

2.1.0

2 years ago

2.0.3

2 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.1-beta0

3 years ago

2.0.0

3 years ago

2.0.0-beta5

3 years ago

2.0.0-beta4

3 years ago

2.0.0-beta3

3 years ago

2.0.0-beta2

3 years ago

2.0.0-beta1

3 years ago

2.0.0-beta

3 years ago

2.0.0-alpha17

3 years ago

2.0.0-alpha16

3 years ago

2.0.0-alpha15

3 years ago

2.0.0-alpha14

3 years ago

2.0.0-alpha13

3 years ago

2.0.0-alpha12

3 years ago

2.0.0-alpha11

3 years ago

2.0.0-alpha10

3 years ago

2.0.0-alpha9

3 years ago

2.0.0-alpha8

3 years ago

2.0.0-alpha7

3 years ago

2.0.0-alpha6

3 years ago

1.9.0

3 years ago

1.8.1

3 years ago

2.0.0-alpha5

3 years ago

2.0.0-alpha4

3 years ago

1.8.0

3 years ago

2.0.0-alpha3

3 years ago

2.0.0-alpha2

3 years ago

2.0.0-alpha1

3 years ago

2.0.0-alpha0

3 years ago

1.7.4

3 years ago

1.7.3

3 years ago

1.7.2

4 years ago

1.7.0

4 years ago

1.6.0

4 years ago

1.5.2

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.2.0-alpha1

4 years ago

1.1.0-alpha0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

1.0.0-rc13

4 years ago

1.0.0-rc12

4 years ago

1.0.0-rc11

4 years ago

1.0.0-rc10

4 years ago

1.0.0-rc9

4 years ago

1.0.0-rc8

4 years ago

1.0.0-rc7

4 years ago

1.0.0-rc6

4 years ago

1.0.0-rc5

4 years ago

1.0.0-rc4

4 years ago

1.0.0-rc3

4 years ago

1.0.0-rc2

4 years ago

1.0.0-rc1

4 years ago

0.0.0-rc1

4 years ago

0.0.0-alpha10

4 years ago

0.0.0-alpha9

4 years ago

0.0.0-alpha8

4 years ago

0.0.0-alpha7

4 years ago

0.0.0-alpha6

4 years ago

0.0.0-alpha5

4 years ago

0.0.0-alpha4

4 years ago

0.0.0-alpha3

4 years ago

0.0.0-alpha1

4 years ago

0.0.0-alpha0

4 years ago

0.0.0-init

4 years ago