Bitcoin address types compared: P2PKH, P2SH, P2WPKH, and more

It was first published Unchained.com.

unchained is the official U.S. co-custodial partner of Bitcoin Magazine and an integral sponsor of related content published through Bitcoin Magazine. Visit our website to learn more about the services offered, custody products, and Unchained’s relationship with Bitcoin Magazine.

If you’ve been using Bitcoin for a while, you’ve probably noticed that some Bitcoin addresses look completely different than others. You may have seen discussion of some acronyms that start with “P2”, such as P2PKH and P2WSH. For those of you who aren’t sure what these acronyms mean, here’s a look at all the standardized on-chain methods for receiving Bitcoin throughout Bitcoin’s history, and some key points that make each method unique. I will explain the differences.

P2PK

Pay-to-Public-Key (P2PK) is the original method of receiving Bitcoin and does not require an address. Instead, as the name suggests, Bitcoins are paid directly to the published public key. The first ever Bitcoin transaction from one person to another was when Satoshi Nakamoto used his P2PK to send coins to Hal Finney in block 170.

P2PK is no longer in use as it is a more expensive, less private, and less secure method of receiving Bitcoin than subsequent methods.

simple facts

P2PKH

Pay-to-Public-Key-Hash (P2PKH) was available in the early days of Bitcoin and first appeared on the blockchain less than two weeks after the Genesis block. P2PKH includes several improvements to P2PK, including the use of addresses.as explained In a previous articlethe address includes a checksum to prevent typos and loss of Bitcoin.

P2PKH addresses are typically 34 or 33 characters long (though theoretically 26 characters minimum), they are encoded as follows: Base58 format.starts with the prefix 1 It currently receives and is responsible for securing 43% of the mined Bitcoin supply, more than any other address type.

Upgrade your Bitcoin security and access exclusive discounts on Unchained financial services.visit our website You can learn more.

To create a P2PKH address, a single public key must be placed through hash functions SHA-256 and RIPEMD-160. This reduces data volume and helps users save block space and transaction fees. It also creates additional resistance to reverse engineering the private key beyond the secp256k1 elliptic curve, which is already believed to be unbreakable.

simple facts

P2MS

Pay-to-Multisig (P2MS) is a simple transaction type that has only been briefly relevant and has never been responsible for holding more than 100 Bitcoins at a time across network participants. Nevertheless, P2MS is part of Bitcoin’s history.

P2MS was introduced as a standard script in early 2012 according to the BIP 11 specification. However, this transaction type involved a public key and did not use an address format, causing the same problems as P2PK. He also limited the number of public keys in a multisig quorum to three. In a few months, P2MS will be replaced by an alternative method for receiving Bitcoin in a multisig agreement called P2SH, which we will discuss next.

simple facts

P2SH

Pay-to-Script-Hash (P2SH) was introduced to Bitcoin as a soft fork following BIP 16 on April 1, 2012. As with most folk, the story behind it is fascinating. P2SH has a lot in common with P2PKH. The main difference is that addresses are created by hashing a redemption script rather than hashing a single public key.

Redemption scripts can be thought of as coded instructions that specify how Bitcoins received at a P2SH address can be used in the future. A wide range of possibilities are possible, including several different public keys. The details of the script are determined by the recipient, not the sender, and usage instructions are not made public until Bitcoin is spent from the address.

Although advanced users can create complex scripts, the most common use of P2SH is to create nested SegWit addresses (discussed below) and multisig wallets. For example, you can include three public keys in your script and specify that signatures from any two of the corresponding private keys can be used to spend Bitcoin. This creates a 2-of-3 multisig address.

Get $100 off your Unchained IRA and get 1 year of free market research from Bitcoin Magazine Pro ($250 value).visit unchained.com Enter code “btcmagi” at checkout.

P2SH addresses are exactly 34 characters long and start with prefix 3, as specified in BIP 13. A small number of transactions experimented with this alternative prefix before the soft fork on April 1st. The first prefix is ​​in Block. 170,052.

simple facts

P2WPKH

Pay-to-Witness-Public-Key-Hash (P2WPKH) is the first of two address types introduced to Bitcoin with the SegWit soft fork in August 2017. The story behind this very important and particularly controversial soft fork is documented in the book . block size warby Jonathan Beer.

P2WPKH is a SegWit variant of P2PKH, and at a basic level it means that choosing this address type over the old P2PKH address will save you transaction fees when moving your Bitcoins.

SegWit addresses look quite different from older address types because they use Bech32 encoding instead of Base58 according to BIP 173. Most notably, Bech32 has no uppercase letters. P2WPKH addresses can be identified by the bc1q prefix and a length of 42 characters.

simple facts

P2WSH

Pay-to-Witness-Script-Hash (P2WSH) is a SegWit variant of P2SH. The main advantage of using P2WSH over P2SH is that it reduces transaction fees. The main reason for using script hashes instead of public key hashes is to accommodate multisig arrangements.

Like P2WPKH, P2WSH addresses start with the bc1q prefix. However, the character length is exactly 62. Unlike the address types previously discussed, P2WSH addresses are created using only the SHA-256 hash function without RIPEMD-160, resulting in longer character lengths. This was carefully implemented and added additional protection from fairly subtle and highly unlikely multisig attack vectors.

simple facts

Nested SegWit (P2SH-P2WPKH and P2SH-P2WSH)

Nested SegWit (also known as wrapped SegWit) is not technically a different address type than the one described above. Still, this is a unique way to use the previously discussed address types in a way that is temporarily useful to the Bitcoin community.

When the SegWit soft fork occurred, not all Bitcoin nodes, software, and services were immediately upgraded to support the new native SegWit address types, P2WPKH and P2WSH. Only entities that have made the upgrade can send to these new addresses. This meant that anyone who needed the ability to receive Bitcoin from anyone (including those who had not upgraded) could not yet use the native SegWit wallet. However, most people wanted to start using SegWit because of its low transaction fees.

A clever solution to this dilemma was to utilize the P2SH transaction type. Entities that have not yet implemented SegWit can still send Bitcoin to P2SH addresses. This is built with a redemption script that specifies instructions on how the Bitcoin can be used later, as explained above. As it turns out, these instructions incorporate the new SegWit spending model, potentially providing users with a bridge to rate savings. Therefore, P2SH addresses that use this trick became known as Nested SegWit and played an important role in the SegWit adoption process.

On the face of it, Nested SegWit addresses are indistinguishable from other P2SH addresses, so we don’t know the supply of Bitcoin held in this arrangement. Additionally, all modern Bitcoin tools can now send directly to native SegWit addresses, so there is no longer a good reason to use Nested SegWit.

simple facts

P2TR

Pay-to-Taproot (P2TR) is the newest address type made available by the Taproot soft fork in November 2021. As of this writing, the adoption rate of P2TR is still very low, with many Bitcoin software and services still working on integration.

P2WPKH and P2WSH are known as SegWit V0, while P2TR is considered SegWit V1. In particular, P2TR utilizes a digital signature algorithm called Schnorr, which is different from the ECDSA format used by previous Bitcoin transaction types. Schnorr signatures have several benefits, including reducing additional transaction fees and increasing privacy.

When it comes to privacy, the key and signature aggregation enabled by Schnorr makes multisig addresses indistinguishable from singlesig. Additionally, the full terms of use of P2TR addresses are not always made public. Address creators can also include multiple customized redemption scripts that they can choose from to spend their Bitcoins later on.

P2TR addresses are 62 characters long and use Bech32m encoding, a slightly modified version of Bech32, as described in BIP 350. P2TR addresses can be identified by their unique bc1p prefix.

simple facts

Reference diagram

Now that we’ve covered all the standardized ways to receive Bitcoin on-chain, we can combine some simple facts and address features into a handy chart for your reference.

It was first published Unchained.com.

unchained is the official U.S. co-custodial partner of Bitcoin Magazine and an integral sponsor of related content published through Bitcoin Magazine. Visit our website to learn more about the services offered, custody products, and Unchained’s relationship with Bitcoin Magazine.

Related Article

0 Comments

Leave a Comment