0
I know that the signing should use public key, what if the private key is used in signing the output? Does that mean anybody can use the money in your wallet? And is there any difference between P2PKH and P2SH?
0
I know that the signing should use public key, what if the private key is used in signing the output? Does that mean anybody can use the money in your wallet? And is there any difference between P2PKH and P2SH?
0
Signing requires the private key, and commits the signature hash of the transaction to the signature. Altering the transaction will change the sighash, and thereby render the signature void.
The public key is required for signature validation. Only the public key hash is shared with the public in form of the address, from which the private key cannot be derived.
P2PKH and P2SH are both standard output scripts in Bitcoin.
Really thank you for your answer, I want to ask one more question: say that the user wrong using the private key sign the output, whether an attacker can steal bitcoin from the input address? – slylljyq – 2019-02-11T20:40:41.923
No, because the input contains the signature, which is only valid for the specific tx. – James C. – 2019-02-11T20:42:15.453
There are three (not two) questions here – amaclin – 2019-02-11T06:26:08.087