Bitcoin Forum
June 23, 2024, 10:07:40 AM *
News: Voting for pizza day contest
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: WHY I CAN'T GET R,S,Z VALUES FROM ALL RAWTX  (Read 141 times)
t3xoff (OP)
Newbie
*
Offline Offline

Activity: 24
Merit: 0


View Profile
September 07, 2021, 02:23:34 PM
 #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 <module>
    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: ''
BlackHatCoiner
Legendary
*
Offline Offline

Activity: 1554
Merit: 7607


Protocols over bureaucrats


View Profile
September 07, 2021, 04:03:33 PM
Merited by pooya87 (2), ABCbits (1), hosseinimr93 (1), NotATether (1)
 #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.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
NotATether
Legendary
*
Offline Offline

Activity: 1638
Merit: 6909


bitcoincleanup.com / bitmixlist.org


View Profile WWW
September 07, 2021, 04:52:31 PM
Merited by pooya87 (2), ABCbits (2), hosseinimr93 (1)
 #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?

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
pooya87
Legendary
*
Offline Offline

Activity: 3486
Merit: 10666



View Profile
September 08, 2021, 03:16:25 AM
 #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.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
t3xoff (OP)
Newbie
*
Offline Offline

Activity: 24
Merit: 0


View Profile
September 08, 2021, 12:39:54 PM
 #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?
NotATether
Legendary
*
Offline Offline

Activity: 1638
Merit: 6909


bitcoincleanup.com / bitmixlist.org


View Profile WWW
September 08, 2021, 01:40:49 PM
 #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).

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!