spesmilo / electrum

Electrum Bitcoin Wallet
https://electrum.org
MIT License
7.22k stars 3.02k forks source link

move libsecp256k1 calls to separate package #9006

Open ecdsa opened 2 months ago

ecdsa commented 2 months ago

Currently, some projects such as python-nostr use cffi based python packages such as secp256k1or coincurve. In contrast, Electrum uses ctypes in order to call libsecp256k1 functions in ecc.py and ecc_fast.py. It would make sense to create a standalone python package for that. That package could be used by other projects, and it would free those projects from importing cffi related dependencies.

Note that some of the methods in ecc.py use cryptography (encrypt_message, verify_message). I think we should not import cryptography in the new package, but rather move those methods to electum/crypto.py.

Not sure how to name the new package. IMaybe python-libsecp256k1 ?

SomberNight commented 2 months ago

Not sure how to name the new package. IMaybe python-libsecp256k1 ?

I strongly think it should have a distinct name. For example, coincurve is a good name because you can easily distinguish it from rusty's secp bindings. python-libsecp256k1 is not a name that can be easily distinguished from rusty's bindings. We could call it electrum-secp256k1. If for some reason we did not want electrum in the name, we could call it secp256k1-ctypes.

That package could be used by other projects, and it would free those projects from importing cffi related dependencies. Note that some of the methods in ecc.py use cryptography (encrypt_message, verify_message). I think we should not import cryptography in the new package, but rather move those methods to electum/crypto.py.

Right, to make the new package useful, I think it should

ecdsa commented 2 months ago