Closed panicfarm closed 1 year ago
No, rust-bitcoin does not have a script debugger. I'm not sure what Rust-based options there are available for that.
No, rust-bitcoin does not have a script debugger. I'm not sure what Rust-based options there are available for that.
Perhaps I could link and wrap bitcoin core to Rust to verify scripts? Are there examples like that?
There's no way to step through scripts, and doing so isn't something generally supported by Bitcoin Core either, but you can use rust-bitcoinconsensus
to get a binary pass/fail given a script and transaction.
There's no way to step through scripts, and doing so isn't something generally supported by Bitcoin Core either, but you can use
rust-bitcoinconsensus
to get a binary pass/fail given a script and transaction.
I am not necessarily interested in stepping through the scripts, I just need pass/fail and all (pubKey, sig) pairs that have been successfully verified in the process.
@panicfarm if your script is valid miniscript, you can do that with the miniscript library. If not, there is more general pass/fail in rust-bitcoinconsensus but that really just pass/fail and can be really annoying, though I have in the past been able to use gdb to see what's actually happening on the C++ side.
If you would want to write a Script debugger in Rust, that would be super epic haha :)
Fwiw, there is https://ide.scriptwiz.app/ which is super helpful too. But tooling is in JS.
Can we close this @panicfarm?
Yes
Is there a Rust validator of arbitrary scripts (not just miniscripts)? A script verification (most often) involves verification of (pubKey, signature) pairs, given the sighash. Is there an API that allows to verify the script and to return all (pubKey, signature) pairs, that have been successfully verified for a given script (regardless of the script logic)?
In bitcoin core, there's btcdeb that allows to step through, replay and validate the scripts.
For example, given tx
b6f7b0b6561c0a7f5f5563c9b257efff0c25ee5b3bf0122c2947e20e713d1fcc
inp0
i did a screen grab showing how btcdeb verifies this non-trivial script.
Here is the screenshot of btcdeb successfully verifying (pubKey, signature) pairs within a complex script, that I am looking for: