# merkle-bitcoin

> Bitcoin-style merkle root generation.

Latest version **1.0.2** (published 2015-08-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install merkle-bitcoin
pnpm add merkle-bitcoin
yarn add merkle-bitcoin
bun add merkle-bitcoin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2015-08-21 |
| First published | 2015-07-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jorge Zaccaro |
| Maintainers | jorgezaccaro |
| Keywords | merkle, bitcoin |

## Links

- npm: https://www.npmjs.com/package/merkle-bitcoin
- Repository: https://github.com/jorgezaccaro/merkle-bitcoin
- Issues: https://github.com/jorgezaccaro/merkle-bitcoin/issues
- npm.io page: https://npm.io/package/merkle-bitcoin

## Dependencies (1)

- [async](https://npm.io/package/async.md) ^1.2.1

## Recent versions

- 1.0.2 (latest) — 2015-08-21
- 1.0.1 — 2015-07-17
- 1.0.0 — 2015-07-17

## README

# merkle-bitcoin
Bitcoin-style merkle root generation.

# Usage

```
npm install merkle-bitcoin
```

``` js
var merkle = require('merkle-bitcoin');
```

# Examples

#### Even number of transactions
``` js
// Generate the merkle root for block #80000
var hashes = [
  "c06fbab289f723c6261d3030ddb6be121f7d2508d77862bb1e484f5cd7f92b25",
  "5a4ebf66822b0b2d56bd9dc64ece0bc38ee7844a23ff1d7320a88c5fdb2ad3e2"
];

merkle(hashes, function (err, merkleTree) {
  console.log(merkleTree.root);
  // 8fb300e3fdb6f30a4c67233b997f99fdd518b968b9a3fd65857bfe78b2600719 
});
```

#### Odd number of transactions
``` js
// Generate the merkle root for block #50001
var hashes = [
    "e1882d41800d96d0fddc196cd8d3f0b45d65b030c652d97eaba79a1174e64d58",
    "7940cdde4d713e171849efc6bd89939185be270266c94e92369e3877ad89455a",
    "f84761459a00c6df3176ae5d94c99e69f25100d09548e5686bd0c354bb8cc60a"
];

merkle(hashes, function (err, merkleTree) {
  console.log(merkleTree.root);
  // ee3a2d2b895cafacff526d06a55b55e049cf84a9735e4a63f7fd08f96d0f4649 
});
```

---
_Source: https://npm.io/package/merkle-bitcoin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
