What is P2PK, P2PKH, P2SH, P2WPKH - ELI5
This is from this entry from StackExchange, I just copy it for backup.
- P2PKH: "Pay To Public Key Hash"
- P2PK: "Pay To Public Key"
- P2SH: "Pay To Script Hash"
- P2WPKH: "Pay To Witness Public Key Hash"
This is how transactions are made. You are requiring the sender to supply a valid signature (from the private key) and public key. The transaction output script will use the signature and public key and through some cryptographic functions will check if it matches with the public key hash, if it does, then the funds will be spendable. This method conceals your public key in the form of a hash for extra security.
This is similar to P2PKH; the difference is that it does not conceal your public key. Anyone using this method to send funds over the P2P network is showing people their public key in the transaction details.
The outputs of a transaction are just scripts that, if are executed with specific parameters, will result in a boolean of true or false. If a miner runs the output script with the supplied parameters and results in true, the money will be sent to your desired output. P2SH is used for multi-signature wallets making the output scripts logic that checks for multiple signatures before accepting the transaction. P2SH can also be used to allow anyone, or no one, to spend the funds. If the output script of a P2SH transaction is just 1 for true, then attempting to spend the output without supplying parameters will just result in 1 making the money spendable by anyone who tries. This also applies to scripts that return 0, making the output spendable by no one.
This can also be used for puzzles like this one.
This was a feature of segwit which stands for Segregated Witness. Instead of using scriptSig parameters to check the transaction validity, there is a new part of the transaction called witness where the validity occurs.
Recuerda compartir esta entrada con tus amigos, porque el conocimiento es la mejor inversión que se puede hacer.
Comentarios
Publicar un comentario