Skip to content
This repository was archived by the owner on Dec 6, 2022. It is now read-only.

WIP big redo with bitcoin-block and full tx, segwit and merkle handling#63

Closed
rvagg wants to merge 29 commits intomasterfrom
rvagg/redo
Closed

WIP big redo with bitcoin-block and full tx, segwit and merkle handling#63
rvagg wants to merge 29 commits intomasterfrom
rvagg/redo

Conversation

@rvagg
Copy link
Copy Markdown
Member

@rvagg rvagg commented May 7, 2020

First commit switches old code to https://ghub.io/bitcoin-block from bitcoinjs and keeps existing tests.

Remainder are basically a rewrite. Don’t look too hard yet, it’s very much a WIP. I’m trying to use the https://github.com/mikeal/js-multiformats interface and it certainly simplifies things quite a lot.

Each of the fixtures have been updated with:

  • JSON form, extracted directly from the bitcoin-cli, unmodified
  • transaction metadata that lists hash, txid and byte location inside the raw block so we can test all of them (quite a lot, 3731 all up, only 8 that are segwit though, I might have to include a more modern block with more segwit).

Proven working bitcoin-block and bitcoin-tx codecs for whole blocks and there’s an encode for blocks with no-witness data but you have to take a back-door to get to that, there’s not really a way to include that as part of the js-multiformats interface (and probably shouldn’t be, but it might be worth discussing at some point). I still need to do the merkle structures which will be bitcoin-tx but 64-bytes long blocks, plus an additional codec that will probably be named bitcoin-witness-commitment for a 64-byte block.

@vmx
Copy link
Copy Markdown
Member

vmx commented May 8, 2020

I had a soft look at it, it really looks promising.

@rvagg
Copy link
Copy Markdown
Member Author

rvagg commented May 16, 2020

Thinking that maybe we should publish this new work as @ipld/bitcoin in a new repo, like the new @ipld/dag-cbor and @ipld/dag-json as a break from the previous generation. It's now completely different from the old code, except for the test fixtures! The API has changed entirely; you could use multiformats/legacy to get the old API back but maybe we should take the approach of archiving these older libraries and publishing fresh ones.
Thoughts @vmx?

@vmx
Copy link
Copy Markdown
Member

vmx commented May 18, 2020

Thinking that maybe we should publish this new work as @ipld/bitcoin in a new repo,

Yes I think that makes sense. Given that we change all of the underlying libraries, I think a clear cut makes things also easier for up-stream maintainers. Then it's clear signal "hey, you probably need a change a lot in your code if you want to use this library as intended" (we have a smoother upgrade path through the legacy API, but ideally people will just use the new API).

@rvagg
Copy link
Copy Markdown
Member Author

rvagg commented May 25, 2020

ok, so a new repo name, should it just be ipld/js-bitcoin? I think this matches the pattern @mikeal is establishing

@rvagg
Copy link
Copy Markdown
Member Author

rvagg commented May 27, 2020

I've pushed this as master to https://github.com/rvagg/js-bitcoin. Docs are done and it should be ready to roll. I propose we move that repo into the ipld org and publish as @ipld/bitcoin.

@rvagg rvagg closed this Apr 23, 2022
@rvagg rvagg deleted the rvagg/redo branch April 23, 2022 12:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants