Post
Topic
Board Development & Technical Discussion
Re: how to sign a rawtransaction
by
pooya87
on 25/04/2024, 09:41:43 UTC
valid = ecdsa.verify((int(r,16),int(s,16)),bytes.fromhex(txid),Qa,curve=curve.secp256k1,hashfunc=sha256)
print(valid)
The "digest" that is used in signing and subsequently for verifying is not the txid, it is double SHA256 hash of a special serialization of the transaction that depends on the type of the output that was being spent.
For example since in this case the output that is being spent is a P2WPKH those steps are explained here: https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki