Author

Topic: WHY I CAN'T GET R,S,Z VALUES FROM ALL RAWTX (Read 156 times)

legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
September 08, 2021, 08:40:49 AM
#6
So what's the solution?

Are you running this with the whole rawtx or just the DER signature of the raw transaction? (you should run it with the whole transaction).

If that's not the case it would be much easier if you post the raw transaction you are running with here, because see can see its length (and script & signature length).

Without that info, all we can do is guess the length of the rawtx with these questions:



What's the length of your script (in characters?)

The scriptLen is defined as : scriptLen = int(txn[41*2:42*2], 16) (chars 82-83) so we know your transaction is at least 84 chars long,

and the sigLen (the part that's giving you the error), is defined as:

    script = txn[42*2:42*2+2*scriptLen]
    sigLen = int(script[0:2], 16)

which means in chars (84-87) the signature length is encoded.



This is all the info we can gleam without the rawtx. You could provide that, or look at chars 84-87 of the rawtx and give us the string of characters placed there (to which we'd probably tell you that your rawtx length is shorter than the 2*sigLen*2+2 number where the public key length is located in i.e. your rawtx is too short).
newbie
Activity: 24
Merit: 0
September 08, 2021, 07:39:54 AM
#5
The error in your script says invalid literal for int() with base 16: '' which means that the Bitcoin script that you, or the program, is trying to parse has an out-of-range start and/or end index (because the input passed to int() is the empty string).

Code:
pubLen = int(script[2+sigLen*2:2+sigLen*2+2], 16)

The only way that something like this can result in an empty string is if the script passed is way too short.

So some of your rawtx's may be too short, maybe you mistakenly truncated them when passing them as input?


So what's the solution?
legendary
Activity: 3472
Merit: 10611
September 07, 2021, 10:16:25 PM
#4
Was the transaction by any chance contained any witnesses (a SegWit transaction)?
I've seen "transaction parsers" in the past that behaved very strangely when they received such transactions due to the existence of a witness marker (0x0001) which breaks them apart.
I believe the script used by 2coin.org was broken like this, which seems to be the same code OP is using.
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
September 07, 2021, 11:52:31 AM
#3
The error in your script says invalid literal for int() with base 16: '' which means that the Bitcoin script that you, or the program, is trying to parse has an out-of-range start and/or end index (because the input passed to int() is the empty string).

Code:
pubLen = int(script[2+sigLen*2:2+sigLen*2+2], 16)

The only way that something like this can result in an empty string is if the script passed is way too short.

So some of your rawtx's may be too short, maybe you mistakenly truncated them when passing them as input?
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
September 07, 2021, 11:03:33 AM
#2
So, I assume you're using this tool: https://github.com/stateactor/Bitcoin-Key-Compression-Tool

Why don't you share us the transactions in which it does work and the ones' it doesn't? That way, we can see if your txraws contain, indeed, a valid signature. Or even better, why don't you create a pull request into this github repository describing your issue explanatorily? You can't really think we are able of helping you by just knowing an invalid literal for a specific variable in an abandoned and mostly unknown project.
newbie
Activity: 24
Merit: 0
September 07, 2021, 09:23:34 AM
#1
NOT ALL RAWTX VALUE GIVES ME R,S,Z VALUES ONLU SOME GIVE AND WORKS FINE.

BUT SOME SHOWS ERROR LIKE,

C:\Users\XXXXX>"C:\Users\XXXXXX\Desktop\blockchain\Bitcoin-Key-Compression-Tool-master\RawTX_RSZ.py"
Traceback (most recent call last):
  File "C:\Users\XXXXXX\Desktop\blockchain\Bitcoin-Key-Compression-Tool-master\RawTX_RSZ.py", line 8, in
    m = txnUtils.parseTxn(tx)
  File "C:\Users\XXXXXX\Desktop\blockchain\Bitcoin-Key-Compression-Tool-master\txnUtils.py", line 39, in parseTxn
    pubLen = int(script[2+sigLen*2:2+sigLen*2+2], 16)
ValueError: invalid literal for int() with base 16: ''
Jump to: