比特币中常用的交易类型(Transaction Types)

Bitcoin的Script

比特币中常用的交易类型

P2PKH – Pay to Public Key Hash

This is the most common type of transaction. To gain access to its outputs, the recipient needs to prove that he can sign a message with the private key (S) which corresponds to public key (P) that hashes to H.

To create a transaction, the payer needs to know the recipient’s address. P2PKH addresses are the Base58Check encoding of version number 0, a hash of the recipient’s public key (H), and a checksum. Due to the way they are constructed,

all P2PKH addresses start with the character “1” .
Example: 1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2

P2PK – Pay to Public Key

With this transaction type, the public key itself is stored in the locking script,
rather than a public-key-hash.

P2PK与P2PKH相比缺点是会暴露公钥。
在用P2PK的情况下,假如椭圆曲线加密算法被破解了,那么整个比特币网络都崩了,但是用P2PKH的话,因为SHA256没有被破解,所以网络还是相当可靠的,你只有在转移钱到一个新地址才会暴露自己的公钥。

OP_RETURN – Data Output

P2SH – Pay to Script Hash

To gain access to outputs sent via P2SH, the recipient must provide a script which matches the given hash and data which makes that script evaluate to True. This allows the recipient to implement various unusual security schemes.

For example, one can thus send bitcoins to multi-signature addresses, which require the signatures of multiple people to spend the outputs.

P2SH addresses are the Base58Check encoding of version number 5, a hash
of the recipient’s public key (H), and a checksum. Due to the way they are constructed,

all P2SH addresses start with the character “3” .
Example: 3EktnHQD7RiAE6uzMj2ZifT9YgRrkSgzQX

你可能感兴趣的:(blockchain,bitcoin,2018)