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

Might be useful to test model instances against libbitcoinconsensus #3

Open
dgpv opened this issue Dec 5, 2020 · 0 comments
Open

Comments

@dgpv
Copy link
Owner

dgpv commented Dec 5, 2020

tools/parse_miniscript_dot.py can now output both script and witness to satisfy the script from the .dot file:

$ tools/parse_miniscript_dot.py ~/miniscript-alloy-spec-generated-samples/8ed9d5a6d084d70e607eb4fb8801ba86d481eb6c/1030.dot 
type=B safe=yes nonmal=yes dissat=no input=n output=nonzero miniscript=and_v(v:and_b(c:pk_h(A),s:sha256(H)),after(500000001))
script: OP_DUP OP_HASH160 <HASH160(A)> OP_EQUALVERIFY OP_CHECKSIG OP_SWAP OP_SIZE <20> OP_EQUALVERIFY OP_SHA256 <H> OP_EQUAL OP_BOOLAND OP_VERIFY <0165cd1d> OP_CHECKLOCKTIMEVERIFY
witness: pub:A sig:A sha256:good

It should be possible to create a mock transaction with an input encumbered by the given script, and try to satisfy the script with witnesses generated according to the output of tools/parse_miniscript_dot.py, using libbitcoinconsensus interface of python-bitcointx: https://github.com/Simplexum/python-bitcointx/blob/d945bf764a3f585e2bf075237a78a708bffefde7/bitcointx/core/bitcoinconsensus.py#L181

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

1 participant