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

Unable to convert value to a Python type when accessing wrapped_script in P2SH #53

Closed
cpsola opened this issue Feb 6, 2018 · 2 comments

Comments

@cpsola
Copy link

cpsola commented Feb 6, 2018

Whenever I try to access the wrapped_script of a P2SH input I obtain this error:

TypeError: Unable to convert function return value to a Python type! The signature was
(arg0: blocksci.blocksci_interface.PayToScriptHashScript) -> Optional[blocksci::AnyScript]

I'm not sure if I am doing something wrong or this is a bug in Blocksci's code.

For instance, this code generates the abovementioned error:

tx0 = blocksci.Tx("e5779b9e78f9650debc2893fd9636d827b26b4ddfa6a8172fe8708c924f5c39d")
for txin in tx0.ins:
    print(txin.address_type)
    print(txin.address.script)
    print(txin.address.script.wrapped_script)

The result of executing the code is:

Pay to script hash
P2SHAddress(address=37paP4uTjmA4Pi85LG6CF9huift3Dw1kFT, wrappedAddress=NonStandardScript())
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-115-1d098e8f187e> in <module>()
      5     print(txin.address.script)
----> 6     print(txin.address.script.wrapped_script)

TypeError: Unable to convert function return value to a Python type! The signature was
	(arg0: blocksci.blocksci_interface.PayToScriptHashScript) -> Optional[blocksci::AnyScript]

So it correctly prints the address_type and script, but fails to show the wrapped script. This also happens with multisig scripts encapsulated in P2SH (not only with non standard ones).

The input of transaction e5779... is spending a P2SH output (the second output of this transaction). The redeem script used to spent the output is PUSHDATA(2)[5357], which is what I am trying to recover.

BTW, the tool is great to explore blockchain data, thanks for making it publicly available!

@hkalodner
Copy link
Collaborator

This is now resolved in BlockSci v0.4

@cpsola
Copy link
Author

cpsola commented Mar 9, 2018

Great, thanks!

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