4

I'm a bit confused about the signature contained in the scriptSig of a transaction. My question is: what do we really sign? Is it the hash of the previous transaction?

6

scriptSig contians a signature of the concantenation* of the previous transaction's script and the new transaction. It has to be both because if it were a signature of just the previous transaction, someone could swap the output address in the new transaction and relay the transaction sending the coins to himself!

scriptSig also contains the public key to verify the signature because the previous transaction only has the hash of the public key. The hash of a public key is an address.

Source: https://en.bitcoin.it/w/images/en/7/70/Bitcoin_OpCheckSig_InDetail.png

* Not really concatenated, it's inserted in the middle.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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