Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract ECC operations to 3rd party module #394

Closed
dcousens opened this issue Apr 10, 2015 · 12 comments
Closed

Extract ECC operations to 3rd party module #394

dcousens opened this issue Apr 10, 2015 · 12 comments

Comments

@dcousens
Copy link
Contributor

As the title says.

For now, I intend to move it to https://github.com/dcousens/libsecp256k1 (I might move that under the bitcoinjs-lib organisation).

By moving it out we can focus on what is important for this library, in this library; and naturally can focus on things like #361 in an external environment.

By doing this, we will have to naturalize (to built-ins or Buffers) such that our API will be more inter-operable.

Also related was #350.

The reason I'm thinking we don't use https://github.com/cryptocoinjs/ecdsa initially, is because, like https://github.com/bitcoin/secp256k1/, the extracted library should be purely for secp256k1.

@jprichardson @rubensayshi @Polve thoughts?

@dcousens dcousens self-assigned this Apr 10, 2015
@dcousens dcousens added this to the 2.0.0 milestone Apr 10, 2015
@jprichardson
Copy link
Member

The reason I'm thinking we don't use https://github.com/cryptocoinjs/ecdsa initially, is because, like https://github.com/bitcoin/secp256k1/, the extracted library should be purely for secp256k1.

This doesn't follow. ecdsa is only secp256k1. I don't think we should use ecdsa though.

My position hasn't changed much regarding my comments in those other threads. In summary, we should move towards elliptic. However, I can definitely see the case for maximum performance. Is it worth the cost though?

Wouldn't it make more sense to prepare to migrate towards elliptic first and then tackle the issue of migrating towards https://github.com/bitcoin/secp256k1/ later? Or does it make more sense to move towards https://github.com/dcousens/libsecp256k1 (marriage of https://github.com/bitcoin/secp256k1/ + https://github.com/cryptocoinjs/ecurve) now?

@dcousens
Copy link
Contributor Author

This doesn't follow. ecdsa is only secp256k1

Oh? I wasn't aware of that (sorry).

My position hasn't changed much regarding my comments in those other threads. In summary, we should move towards elliptic. However, I can definitely see the case for maximum performance. Is it worth the cost though?

Agreed, that is the plan. As for the performance cost, I think that is something we can measurably move towards without fundamentally giving up anything; the only problem is that it is going to take a while to do so.

Wouldn't it make more sense to prepare to migrate towards elliptic first and then tackle the issue of migrating towards https://github.com/bitcoin/secp256k1/ later? Or does it make more sense to move towards https://github.com/dcousens/libsecp256k1 (marriage of https://github.com/bitcoin/secp256k1/ + https://github.com/cryptocoinjs/ecurve) now?

As for the migration plan, elliptic simply isn't ready yet, but this move should be done in such a way that gets us API parity, so we aren't wasting effort.

@rubensayshi
Copy link
Contributor

I think creating some wrapper so we can easily switch which package is used would be great and we should go straight for that instead of taking intermediate steps.
Once that is done it's also easy to add any other implementations if there's a desire for it.

I don't like the name libsecp256k1, maybe secp256k1-wrapper or something ...
libsecp256k1 suggests to me that it's another implementation

@ryanxcharles
Copy link

My two cents: I would really like to see an elliptic curve library as fast as Fedor's elliptic but with only secp256k1 designed only for bitcoin. The pure javascript analog of libsecp256k1. If ever such a library were created, that's what I would recommend for bitcoinjs-lib.

@dcousens
Copy link
Contributor Author

I don't like the name libsecp256k1, maybe secp256k1-wrapper or something

Except that would mean we have no freedom to include our own implementation later if that is preferred.

@indutny
Copy link

indutny commented Jun 23, 2015

@ryanxcharles I'd say that elliptic was designed with secp256k1 in mind ;) It is using GLV because of it, and everything there was benchmarked and optimized using secp256k1 curve.

@jprichardson
Copy link
Member

Anymore thoughts on the direction that we're going here?

@dcousens
Copy link
Contributor Author

dcousens commented Jul 7, 2015

@jprichardson I think with #420 in place for 2.0.0, we can safely iterate on this issue for the remainder of 2.x.y.

The last thing we need to do to be able to easily "break away" and have the freedom of choice to move around in this domain is to resolve #407.

I'm hoping to have a look at that today.

@axic
Copy link

axic commented Mar 22, 2016

Is there any progress on this?

@dcousens
Copy link
Contributor Author

ping @fanatid, status on node secp256k1 lib?

@fanatid
Copy link
Member

fanatid commented Mar 23, 2016

I think it's ready for use, probably we should create branch v3.0.0 and merge #440 #456 #459 there, because without this integrate secp256k1 more difficult. I'd also like use dominictarr/varstruct for block/transactions and move hdnode (bip32), script, transactions builder to their own packages.

EDIT: There are a lot of work and probably first we should finish with extracted packages. For example with bitcoinjs-message: bitcoinjs/bitcoinjs-message#2 ;)

@dcousens
Copy link
Contributor Author

Closing in favour of #623

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants