Post
Topic
Board Development & Technical Discussion
Re: VERIFYING RAW BITCOIN TX USING SAGEMATH (pure ecdsa in math)
by
NotATether
on 22/02/2021, 12:26:55 UTC
Hello everybodey !!!

Why this python scrypt not work for sach transaction ? https://blockchair.com/bitcoin/transaction/a2c5d8b22062d71f52f8ce86f98c9abbd7bf82e1b96b9c61f48fd7ed99d2635c

Then I use, I get error n python:

 ================

Traceback (most recent call last):
  File "D:\hash.py", line 10, in <module>
    m = txnUtils.parseTxn(tx)
  File "D:\txnUtils.py", line 36, in parseTxn
    sigLen = int(script[0:2], 16)
ValueError: invalid literal for int() with base 16: ''


How to modify code for working fine without error Huh

Big Thank You !!!

Can you open line 36 in txUtils.py and insert the following code before it?

Code:
import pdb
pdb.set_trace()

This will spawn a debugger when you get to that line. Use it to see the value of "scriptLen", what are the contents of "script" and most importantly what is the value of script[0:2] when you call int() (just type the variable names as if it were the Python console).

I strongly believe that whatever raw transaction you passed is less than 41*2 bytes and so the whole string has been absorbed into "first". Python doesn't raise any exceptions for out-of-range indices and instead just returns an empty string.