Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: victorkimba17 on May 09, 2019, 05:48:41 AM



Title: Question about P2PKH
Post by: victorkimba17 on May 09, 2019, 05:48:41 AM
I read this article in https://en.bitcoin.it/wiki/Transaction

P2PKH uses :
Code:
scriptPubKey: OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG
scriptSig: <sig> <pubKey>

scriptSig is supplied by the redeemer. scriptPubKey is from the referred previous transaction.

For example. i send bitcoin to the recipient using the pubkeyHash of the recipient. Because the redeeming condition requires the pubKey and the sig, does it mean anyone with the pubKey and sig can redeem the bitcoin?


Title: Re: Question about P2PKH
Post by: achow101 on May 09, 2019, 06:00:08 AM
Because the redeeming condition requires the pubKey and the sig, does it mean anyone with the pubKey and sig can redeem the bitcoin?
Yes. Anyone who can provide the public key and a valid signature can spend that output. However there is no one signature; the signature is specific to the spending transaction. So in order to create a valid signature, you also need to have the private key for the public key.


Title: Re: Question about P2PKH
Post by: victorkimba17 on May 09, 2019, 06:45:21 AM
Thank you.

From:
https://bitcoin.org/en/transactions-guide#introduction

Code:
An secp256k1 signature made by using the ECDSA cryptographic formula to combine certain transaction data
 (described below) with Bob’s private key. This lets the pubkey script verify that Bob owns the private key which
created the public key.