4

So the scriptsig field in the transaction, is created with the signature and public key. In order to create the signature, we need the R and S values of a ECDSA signature. I figured how to sign a string with Secp256k1, but I haven't figured out exactly what am I signing.

1 Answer 1

1

You are signing a specially modified version of the transaction itself. The modified transaction involves replacing the scriptSig field temporarily with the scriptPubKey from the transaction output being spent, and leaving all other inputs' scriptSigs empty, and then appending a 4 byte signature type code. The transaction is then hashed twice with SHA256 and the final hash is signed.

See this question for more info: How to redeem a basic Tx?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.