-
Notifications
You must be signed in to change notification settings - Fork 14
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
Pass network as optional parameter #6
Conversation
…eter Feature/optional network parameter
Thanks for the pull request. Based on the files changed, it seems like the main objective is to enable BIP137 and BIP322 signature verification for regtest addresses. Is that correct? |
…eter Remove debug logging
Yes, enabling it for regtest and possibly making it compatible with other networks in future such as the liquid network. |
Is there any reason why the network cannot be inferred from the address given, but have to be exposed directly? |
Yes, I can think of 2 reasons:
|
As far as I know, signature that is valid for a mainnet address is equally valid for its testnet equivalence, and vice versa. By not wanting to "accidentally validate testnet addresses", do you mean you don't want to accidentally pass a testnet address into the verifySignature method when you only want to validate mainnet addresses? |
…eter Remove not needed test
Yes, it's also the standard behaviour of bitcoin core, when an address is provided that is not for the same network. |
I am still doubtful about this particular use case. The signature itself is network-neural, and it is valid for all addresses that can be derived based on the corresponding public key. Other libraries such as the widely used bitcoinjs-message also does not impose such limit on the network - the same signature would verify as The problem of "accidentally passing in a testnet address" sounds like a user-input validation problem, rather than an issue that must be dealt with in this library. While this could be a useful feature to restrict signature verification on a specific network, I am doubtful on whether it should be mandatory. In my opinion, it is better to infer the network automatically, but allow the option to restrict to a particular network type (as a bonus feature). |
I changed the code so the network is inferred at the beginning of the verification routine. Therefore the scope of the PR changed to
|
…eter Detect network from address
Bugfix/compilation on npm install
Feature/update bitcoinjs lib
Feature/refactoring
When is this PR getting merged? |
Sorry, but I currently do not have the time to review this pull request in details. This may get merged in late April or early May. |
Closing in favor of pull request #10. Thank you for your contribution. |
For improved testability and enabling me to develop using regtest, I need to be able to pass the network into the verify method.
This is already the case for signing.