I have read a few posts and I am familiar with how scriptsig is formatted and how to extract relevant information from it. The problem I am having is putting it into code. I have read these posts: https://bitcoin.stackexchange.com/questions/58853/how-do-you-figure-out-the-r-and-s-out-of-a-signature-using-python https://bitcoin.stackexchange.com/questions/2376/ecdsa-r-s-encoding-as-a-signature
I have a list of scriptsigs and I have a function (so far) that uses slicing on the scriptsig string:
def scriptsig_to_ecdsa_sig(asn_sig):
strip1 = asn_sig[6:] #Remove first 6 characters
if strip1[:2] == "20" #Read next two characters to determine length of r
return {
'r': some list,
's': some list}
Would this be the best route? If so, how would the best way to finish it be?
Figured it out:
from pyasn1.codec.der import decoder as asn1der
int_value = asn1der.decode(asn_sig.decode('hex')[1:]) #asn_sig is the scriptsig hex
long(int_value[0][0]) #R Value in int form
long(int_value[0][1]) #S Value in int form