Post
Topic
Board Development & Technical Discussion
Re: VERIFYING RAW BITCOIN TX USING SAGEMATH (pure ecdsa in math)
by
COBRAS
on 22/02/2021, 13:56:19 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.

Bro, thx for your reple.

For me say what,

tx = "01000000000101881af1640424935b4f0c54c6fe9f5acd9750aa3b9bda50909a5b8f5da69ced8b0 200

00


0000fdffffff0bc7670403000000001976a9146460c7b1069f32a7e5382266b364220f3f824ec68 8ac8023430000000000
1976a91485f4f96f3f991a3770face96abc0ca59965220fb88ac4b601800000000001976a9147bf 1438d53b8d0a
115203375b8a5f9ddcc0c520f88ac113c00000000000017a914742ce9c25e8bd7a30053ee164ca4 55bf6bd5a6f5
87a0860100000000001976a914ecd84afa213d4edb6ecb21542ce519ce3618bdaf88ac9e212a000 000000017a9
1431e83e8b275717a102025822f7fab06b3c6f7ff987b01e0400000000001976a9140a5d69037c1 94b6aec05358
25eb6ba508d97570d88ac20505300000000001976a914955db0cde749821c6f99934cc5c1232c63 6cf97d88ac3
0570500000000001976a91404139abd0c8f9cd51a8756c69379041fa14ed91488ac80e66a390000 0000160014
5c1e9c33747070609ed2610a374eea857e427e68a08601000000000017a9140a3c23a5197a790e6 1b806ce702
d4dec2ed4700b87024730440220381776b6b7d25f90bb8f078a213464fc2d6ae5834e3f79cb9032 e5dd8f89f5ae
02207bd3d9b5680241b0951ad61f4b041c5ee0698d5673e78fe54224ca753a8eb2cc01210210917 1217733e1af
a913cb3e13d4582693045df2467e818ab1eba5ae2391f785c13f0a00"


Bolded 00 new string for python !!! So, after bald python get empty data....... Undecided

I try solve, now not successful... work continued....