python-nostr icon indicating copy to clipboard operation
python-nostr copied to clipboard

Would a PR which replaces secp256k1 by coincurve be accepted?

Open holgern opened this issue 2 years ago • 11 comments

@jeffthibault Would you be willing to accept a PR in which secp256k1 is replaced by coincurve (https://github.com/ofek/coincurve) ?

The advantage is that coincurve is a cross-plattform binding for libsecp256k1.

Before I make everything ready, I just want a confirmation.

holgern avatar Feb 06 '23 08:02 holgern

I decided to make a fork for now: https://github.com/holgern/pynostr

holgern avatar Feb 09 '23 17:02 holgern

Coincurve does not enable us to do ECDH for nostr. I have added a PR to embit that does. After the next release of embit, I will add it here which will enable windows support. I also prefer to use embit because it includes other components that can be used in this library.

jeffthibault avatar Feb 11 '23 14:02 jeffthibault

It is possible with coincurve when

from coincurve._libsecp256k1 import ffi, lib
HAS_ECDH = hasattr(lib, 'secp256k1_ecdh')

At least on windows HAS_ECDH is true for me.

You can check my implementation: https://github.com/holgern/pynostr/blob/main/pynostr/key.py

It is possible to do encrypted DMs with it.

holgern avatar Feb 11 '23 14:02 holgern

It would be cool when everything works with embit, good work!

holgern avatar Feb 11 '23 14:02 holgern

Thanks!

Okay, I understand what you're doing. However, I still prefer embit for reasons mentioned above. Should be supported soon.

jeffthibault avatar Feb 11 '23 19:02 jeffthibault

Is embit version available with pip install nostr ?

daiangan avatar Feb 19 '23 22:02 daiangan

alternate pr, didn't know the other was available... uses compat layer so code is minimal: https://github.com/jeffthibault/python-nostr/pull/84/files

earonesty avatar Feb 27 '23 05:02 earonesty

alternate pr, didn't know the other was available... uses compat layer so code is minimal: https://github.com/jeffthibault/python-nostr/pull/84/files

@earonesty Will this pull request be implemented at some point? Are there really plans for the library to be compatible with Windows or Mac M1-M2 at some point? It would be very useful to have this clear to know whether to use python-nostr or look for other alternatives for systems that do not support secp256k1. Thanks.

daiangan avatar Mar 24 '23 13:03 daiangan

will the pr be merged soon?

davidtavarez avatar Mar 28 '23 08:03 davidtavarez

Hey there, heads up that I just released coincurve v21.0.0 which brings performance improvements and removes all runtime dependencies!

ofek avatar Mar 08 '25 15:03 ofek

Hey there, heads up that I just released coincurve v21.0.0 which brings performance improvements and removes all runtime dependencies!

thank you 🙏

davidtavarez avatar Mar 09 '25 09:03 davidtavarez