btcpy icon indicating copy to clipboard operation
btcpy copied to clipboard

ScriptBuilder definition for transaction creation

Open maxcado opened this issue 6 years ago • 0 comments

In the samples on your readme for transaction creation you have the following:

from btcpy.structs.transaction import Transaction, TxIn, Sequence, TxOut, Locktime

script_sig = Script.unhexlify('48304502210083e6e7507e838a190f0443441c0b62d2df94673887f4482e27e89ff415a90392022050575339c649b85c04bb410a00b62325c1b82c537135fa62fb34fae2c9a30b0b01210384478d41e71dc6c3f9edde0f928a47d1b724c05984ebfb4e7d0422e80abe95ff') script_pubkey = ScriptBuilder.identify('76a914905f77004d081f20dd421ba5288766d56724c3b288ac') tx = Transaction(version=1, ... ins=[TxIn(txid='1a5a4f9a0d34cfca187db4fe6a3316f46264984c4b4c9fdb582123815afd508f', ... txout=0, ... script_sig=script_sig, ... sequence=Sequence.max())], ... outs=[TxOut(value=193000000, ... n=0, ... script_pubkey=script_pubkey)], ... locktime=Locktime(0)) tx.txid '14e6afbae7d2b1825b7ee711cbcad77d519767b70f5a1e70e5ba7f0bfc902e81'

However, there is an error regarding ScriptBuilder when get to: script_pubkey = ScriptBuilder.identify('76a914905f77004d081f20dd421ba5288766d56724c3b288ac')

The error is ScriptBuidler is not defined.

In fact many of the samples you have on the readme do not work when someone goes through it with regards to transaction creation. Another issue is using from btcpy.structs.script import StackData, empty_script. Error is cannot import name 'empty_script.'

Does someone take the time to go through the steps of what is shown on the readme file?

maxcado avatar Dec 21 '19 13:12 maxcado