bitcoinjs / bitcoinjs-lib

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

TODO: Miniscript library under bitcoinjs org #1464

Open blmalone opened 4 years ago

blmalone commented 4 years ago

For more information see this Introduction and Live Compiler

junderw commented 4 years ago

I think this would be good for a separate library under the bitcoinjs org.

Since many people who are not Bitcoin devs will also likely use it.

landabaso commented 1 year ago

Do you guys know about any progress on this by anyone?

landabaso commented 1 year ago

I've been investigating this.

We could use sipa's implementation (wasm) or rust-miniscript (also wasm?).

I managed to convert sipa's implementation into pure javascript (no wasm) using binaryen wasm2js, so we could even build a pure javascript version (it was very fast based on some examples I tested).

However, the last piece I'm missing in both packages is witness creation (how to produce the unlocking script).

There are not (yet) reference implementations for witness creation from arbitrary miniscripts. rust-miniscript is able to sign arbitrary descriptors but I believe there is no way to get the witness for an arbitrary policy.