1

In this question on libsecp256k1 Pieter Wuille stated:

libsecp256k1 provides implementations for all kinds of operations that involve private keys, public keys, or both. That includes key generation (computing public key given private key), key derivation (e.g. BIP32), as well as signing and verifying digital signatures (ECDSA, since recently also BIP340 Schnorr)

In the same vein as libbitcoinkernel attempting to define what is consensus and what isn't is there code in libsecp256k1 that isn't strictly related to secp256k1 operations (and maybe isn't consensus critical e.g. wallet) and could/should be moved to the Core codebase? Or is there a clean separation (as clean it can be)? Examples if they exist would be great.

1 Answer 1

5

I think the boundary between libsecp256k1 and Bitcoin Core is pretty clear: everything that involves operations on private or public keys is in libsecp256k1.

Of course, in theory, anything can be anywhere, but I don't think there is much leeway here. In fact, I think recently the intention has been to go the other way, and expand slightly what is in libsecp256k1. In particular, there are currently key-tweak operations in libsecp256k1 (both on private and public keys), but things like the actual BIP32 derivation logic (including hashing etc.) and the taproot key tweaking and verification thereof are in Bitcoin Core, building on libsecp256k1's tweaking API. I think that at some point we'd like to have BIP32 and Taproot-specific APIs in libsecp256k1 instead, as we aim to have APIs there that are high-level and hard to misuse.

Of course, libsecp256k1 isn't just used by Bitcoin Core, so even if there was a desire to go the other way (and move some logic to Bitcoin Core), we wouldn't necessarily be able to do that, as there may be other users of the library that could be depending on said hypothetical functionality.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.