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

Possible path for removing bitcoinconsesnus dependency?? #7

Open
rajarshimaitra opened this issue Jun 27, 2022 · 3 comments
Open

Possible path for removing bitcoinconsesnus dependency?? #7

rajarshimaitra opened this issue Jun 27, 2022 · 3 comments

Comments

@rajarshimaitra
Copy link
Contributor

rajarshimaitra commented Jun 27, 2022

The bitcoinconsensus crate is used to do the proof verification here https://github.com/weareseba/bdk-reserves/blob/61b5f517f4c227bdf62507d1fcc2fd79bb87db8d/src/reserves.rs#L273-L279

BDK exposes a very similar functionality in the wallet api itself with the verify feature flag and uses the same bitcoinconsensus underneath like this..

https://github.com/bitcoindevkit/bdk/blob/2283444f727b85663b19d100af86db4392ebc891/src/wallet/verify.rs#L58-L68

This api is publicly exposed via verify feature of BDK.. So may be one more opportunity to reduce external dependency on bitcoinconsensus??

But might need some restructuring of the proof verification logic in this crate..

@ulrichard
Copy link
Collaborator

I think I looked into this a while ago. Back then it didn't quite match. But maybe something has changed in the meantime, and it is worth another detailed look. If it works out, it would certainly be cool.

@rajarshimaitra
Copy link
Contributor Author

I would guess nothing changed much since your last look.. This part of lib hasn't been touched much.. The API asks for a full Transaction and the database (can be taken from the wallet) and performs the same consensus verification call as in the bare code in this crate..

So it depends on weather stuffs being verified here can be a full transaction itself in the wallet db.. In that case it should be theoretically possible to use this API instead of the bare call.. All this api does, before the bare bitcoinconsensus::verify is to get the prev outputs and script pubkeys from the given transaction..

@ulrichard
Copy link
Collaborator

I just had a quick look at this again. Since the first input is the special hashed message, I would need a way to skip the first input. Adding functionality to skip some inputs might undermine the validity for normal transactions.

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

No branches or pull requests

2 participants