bitcoinjs / bitcoinjs-lib

A javascript Bitcoin library for node.js and browsers.
MIT License
5.66k stars 2.09k forks source link

Extract merkle calculations to 3rd party package #581

Closed dcousens closed 7 years ago

dcousens commented 8 years ago

As per https://github.com/bitcoinjs/bitcoinjs-lib/pull/580, we should extract the merkle calculations to a 3rd party generic package which is agnostic of transactions, and simply operates on hashes.

This way it can be used for more than just bitcoin transactions. The only pre-requisites is that it should be using Buffers, with extensive testing and it should probably be as concise as our own implementation. Performance should also be on par or better.

I personally would like to use merkle trees in this way, so if I [or others] can't find something suitable, I'm up for implementing it under bitcoinjs org.

Thoughts @jprichardson @fanatid ?

jprichardson commented 8 years ago

Yep, I like this idea.

dcousens commented 8 years ago

ping @olalonde, maybe we could use your package at https://github.com/blockai/merkletree, it meets most (performance isn't as high) of the above requirements quite well.

My main concern is that it is written in ES6, which might still discriminate many of our users who are just trying to keep up with the minor release cycle.

olalonde commented 8 years ago

@dcousens would be happy to collaborate. As a user of this library, you wouldn't really need to worry about it being written in ES6 as I compile it with babel before publishing to npm. I didn't really worry about performance when writing it but I'm sure it wouldn't be too hard to optimise.

dcousens commented 7 years ago

Closing in favour of https://github.com/bitcoinjs/bitcoinjs-lib/pull/653