btcsuite / btcd

An alternative full node bitcoin implementation written in Go (golang)
https://github.com/btcsuite/btcd/blob/master/README.md
ISC License
6.1k stars 2.31k forks source link

Miniscript #1986

Open benma opened 1 year ago

benma commented 1 year ago

Hi

I just open sourced my implementation of Miniscript at https://github.com/benma/miniscript-go.

It depends on btcd for script generation and unit testing redemption (executing the script and witness to check that witness generation works).

kon from Lightning Labs pinged me about making a PR here. I think inclusion into btcd would be a very good idea:

My time is currently stretched very thin however, so I'd require someone else to take the above code, fill in the missing parts, open a PR here and bring it over the finish line.

There is even an accompanying blog post that explains how much of the code works :smile:

Any takers? @Roasbeef @guggero - please tag anyone who might be interested

guggero commented 1 year ago

Cool, thanks a lot for the implementation! I might take a stab at integrating it as a weekend project. Though since I don't know when that will be, if anyone's faster than myself, please go ahead! I think it definitely makes sense to integrate the code into btcd.

Regarding attribution/license, how would you like us to proceed? Since your repo doesn't have a license. Would it be okay if the PR that adds your code would have you as the author and then any follow-up commits with changes would be the PR author? That would put your code under the ISC license.

benma commented 1 year ago

Great!

Regarding attribution/license, how would you like us to proceed? Since your repo doesn't have a license. Would it be okay if the PR that adds your code would have you as the author and then any follow-up commits with changes would be the PR author? That would put your code under the ISC license.

Sounds good and ISC is fine. I quickly made this commit by just moving over all files to txscript/miniscript, if it helps:

https://github.com/benma/btcd/commits/miniscript

Feel free to take it and build on top. There is already one CI error: strings.Cut() was only added in Go 1.18, while btcd is using Go 1.17 at the moment.

Roasbeef commented 1 year ago

Re the version: we tyupically try to track the last two versions (so Go 1.19 and 1.20 rn) so I think no issue bumping it. We'll also likely have more code start to use generics (eg: #https://github.com/btcsuite/btcd/issues/1934) in the near future.

benma commented 1 year ago

@Roasbeef it would be great avoid generics until https://github.com/gopherjs/gopherjs/issues/1013 is resolved - we use GopherJS to compile a library making use of btcd to JS.

Should even consider sticking to 1.17 until GopherJS catches up. strings.Cut() can easily be replaced.