-
Notifications
You must be signed in to change notification settings - Fork 645
Open
Description
For example the transaction 858eb08ea0e24b052a5945270475af4e49f5b7158d9d5b6218bff53d1d9d53e9
from bitcoin.core import *
from bitcoin.core.script import *
raw_txid = '010000000190664219e4eedfc97020d7a7bacddaaf5abbe20e3f0a5e77e9ae85bcdf6a0fd0910000006f0047304402207bf94f0f703364bbc008fe814061a36f421a59153b49131b828e583802cb13670220301095b2cb26623840455155e97ed1831d05a50798128a21ae83e38e8bcd90680125512102494948b6192ca3615e443c10ec058497c2b6785c9c960940de15583930ad97c751aeffffffff01900e4d000000000017a914497d58d263bd82b460bdc9b8c69ca6e25acc99938700000000'
ctx = CTransaction().deserialize(bytes.fromhex(raw_txid))
publickey = '512102494948b6192ca3615e443c10ec058497c2b6785c9c960940de15583930ad97c751ae'
value = int(0.051*COIN)
cs = CScript(bytes.fromhex(publickey))
sighash = SignatureHash(cs, ctx, 0, SIGHASH_ALL, value, 0)
print(b2x(sighash))
results:
Traceback (most recent call last):
File "/home/pc/Desktop/Pycharm/Transaction_Parser/test/test.py", line 11, in <module>
sighash = SignatureHash(cs, ctx, 0, SIGHASH_ALL, value, 0)
File "/home/pc/Desktop/Pycharm/venv/Ubuntu/lib/python3.6/site-packages/bitcoin/core/script.py", line 1018, in SignatureHash
assert not script.is_witness_scriptpubkey()
AssertionError
Possible workaround is to comment out line 1018 assert not script.is_witness_scriptpubkey(), which then results the right SignatureHash '847b08415229a2a728f6a22077f2ad5c69faf6ae81d6c16f16e61425dc9a984f'.
Metadata
Metadata
Assignees
Labels
No labels