Post
Topic
Board Development & Technical Discussion
Re: Using Pycoin to spend non-standard scripts
by
HeadsOrTails
on 18/07/2015, 06:41:04 UTC
How would I use Pycoin to play around with non-standard scripts like this? Alternatively, pybitcointools.
Writing a Script "compiler" in python should be very straight forward.  PyBitcoinTools will parse out the scripts with deserialize, then you take the Script 'asm' and write a decompiler.

If you then put the 'asm' data back in the dict and serialize with pybitcointools you should be good to go.

Thanks for the reply!

I'm really familiar with pybitcointools, so I can certainly see how your suggestion works. However, the issue is when using serialize_script; namely, if you've got objects (like a pubkey), the serialize_script method doesn't add push codes for the size of the object.

Ie:

Code:
my_script = serialize_script([OP_foo, OP_bar, "20byte_pubkey_hash", OP_spam])

myscript will return 11 22 01234567890123456789 33 instead of 11 22 14 01234567890123456789 33