vk = ecdsa.VerifyingKey.from_string(bytes.fromhex(pubKey),curve=ecdsa.SECP256k1)
if vk.verify(bytes.fromhex(signature), bytes.fromhex(sha256_hash), hashlib.sha256, sigdecode=sigdecode_der) == True: # True
print("Signature is Valid")
else:
print("Signature is not Valid")
I am trying to verify a transaction using secp256k1_generator, but I can’t seem to get the signature into the correct (r,s) format, and am getting the following output
File "/.local/lib/python3.10/site-packages/ecdsa/keys.py", line 741, in verify_digest
raise BadSignatureError("Signature verification failed")
ecdsa.keys.BadSignatureError: Signature verification failed
I have taken help of Signature verification in python using compressed public key
and
https://stackoverflow.com/questions/73630540/how-to-verify-ecdsa-signatures-with-python
But still I am getting this error. How can I resolve it?