full edit

This commit is contained in:
Shannon Appelcline 2026-02-19 13:08:04 -10:00 committed by GitHub
parent 8e1111a6fb
commit 65b70612dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,7 +4,7 @@ You understand your wallet now, but there's still the question of the addresses
## Understand Addresses
As you know, each Bitcoin address is a storage area for Bitcoin funds. Funds are sent from one address to another address as a _transaction_; the transaction matches the address that it was sent from. But an address is more than just a storage area: it's a lockbox. The specifics of the address define how that lockbox is actually opened up. The default is to use a private key associated with the public key that was used to create the address, but that's not the only way that Bitcoin addresses work.
As you know, each Bitcoin address is a storage area for Bitcoin funds. Funds are sent from one address to another address as a _transaction_. But an address is more than just a storage area: it's a lockbox. The specifics of the address define how that lockbox is actually opened up. The default is to use a private key associated with the public key that was used to create the address, but that's not the only way that Bitcoin addresses work.
Different types of Bitcoin addresses change all of this. In general they may change:
@ -16,35 +16,36 @@ Different types of Bitcoin addresses change all of this. In general they may cha
### The Segwit Address(es)
The most common sort of address actively used in the modern Bitcoin world is called by two different names that both mean the same thing: the Bech32 address (which names its encoding method, and technically includes other address types that are also encoded that way) or the SegWit address (which stands for "Segregated Witness" and describes how transactions sent to it must be formed). All Bitcoin addresses also have a "Pay-to" name, and Segwit addresses are called P2WPKH, which stands for "Pay to Witness Public Key Hash," which is a mouthful that will make more sense when you've met the older address types.
All Bitcoin addresses have a "Pay-to" name, and Segwit addresses are called P2WPKH, which stands for "Pay to Witness Public Key Hash," which is a mouthful that will make more sense when you've met the older address types. It's also called a Bech32 address (to describe its encoding method) or a SegWit address (to describe how its signature is stored), but there are other types of addresses that are also Bech32-encoded or SegWit.
Segwit came out of the Blocksize War of the '10s, where Bitcoin developers and users were trying to figure out a way to speed up the Bitcoin blockchain by allowing more transactions to be sent in less time. The result was the segwit soft fork. It solved the problem by moving the signatures (which are the key you use to unlock most Bitcoin transactions) from the middle of the transaction to the end, and then making that end space into increased space to store transactions, that could also be ignored by older servers. This allowed for an increase in the space to store transactions that was phased in gradually.
SegWit came out of the Blocksize War of the '10s, where Bitcoin developers and users were trying to figure out a way to speed up the Bitcoin blockchain by allowing more transactions to be sent in less time. The result was the SegWit soft fork. It solved the problem by moving the signatures (which are the key that you use to unlock most Bitcoin transactions) from the middle of the transaction to the end, and then making that end space into increased space to store transactions, but space that could also be ignored by older servers. This allowed for a "blocksize increase" that was phased in gradually. The original version of SegWit used by P2WPKH is now called SegWit v0, with SegWit standing for "Segregated Witness", which describes that separation between the main part of the transaction and the signature.
The specifics aren't that important. What is important is that Segwit addresses (or Bech32 addresses or P2WPKH address) are the default type of address; when you created an address in [§3.3](03_3_Setting_Up_Your_Wallet.md), this is what you created.
The specifics aren't that important. What is important is that P2WPKH, and a few other SegWit addresses that we'll meet shortly, are the default type of address; when you created an address in [§3.3](03_3_Setting_Up_Your_Wallet.md), you created a P2WPKH.
> :book: **What is a fork?** A fork is a change to the Bitcoin protocol. This isn't just a change to how one application (like Bitcoin Core) works, it's a change to how all of the members of the Bitcoin network agree to interact with each other. A hard fork makes new transactions incompatible with old transactions. It essentially two versions of Bitcoin (and most often has been used to actually create a new cryptocurrency). A soft fork ensures that old transactions remain compatible.
> :book: **What is a fork?** A fork is a change to the Bitcoin protocol. This isn't a change to how one application (like Bitcoin Core) works, it's a change to how all of the members of the Bitcoin network agree to interact with each other. A hard fork makes new transactions incompatible with old transactions. It essentially creates two versions of Bitcoin (and most often has been used to actually create a new cryptocurrency). A soft fork ensures that old transactions remain compatible.
### The Rest of the Addresses
Here's a comprehensive listing of the address types, with the ❌ addreses largely deprecated (meaning don't worry about them!) and the ✅ addresses being the current ones (meaning that they will be relevant to your use of Bitcoin).
Here's a comprehensive listing of all the address types that have existed in Bitcoin's history, with the ❌ addreses largely deprecated (meaning don't worry about them!) and the ✅ addresses being the current ones (meaning that they will be relevant to your use of Bitcoin). Don't be overwhelmed by this list! If it looks like too much, just scan the ✅ addresses, which will be the only one used in this course, and come back and look at some of the other varieties if they come up and you want to figure out what they do exactly.
Don't be overwhelmed by this list! If it looks like too much, just scan the ✅ addresses, which will be the only one used in this course, and come back and look at some of the other varieties if they come up and you want to figure out what they do exactly.
The addresseses commonly in use for new Bitcoin addresses today are:
The addresseses commonly in use for Bitcoin today are:
* **✅ P2WPKH (Pay to Witness Public Hash).** P2WPKH is a SegWit address that can be unlocked with a single key. This is the default address type for Bitcoin Core, and what you'll mostly be using. P2WPKH deprecates P2PKH.
* **✅ P2WSH (Pay to Witness Script Hash).** P2WSH is a SegWit address that can be unlocked by a script (rather than one or more private keys doing so). Scripts are described in [Chapter 11](11_0_Introducing_Bitcoin_Scripts.md) (and afterward). P2WSH deprecates P2SH.
* **✅ P2TR.** Taproot is the newest Bitcoin address type, but it was soft forked back in 2021, so it should have wide acceptance at this point. It's considered to be SegWit v1. Due to its use of Schnorr signatures, it can produce smaller transactions for multisigs, has privacy advantages, and can also combine singular signatures with scripts. It hasn't been widely adopted yet. We'll examing Taproot transcations starting in [Chapter 9](09_0_Expanding_Bitcoin_Transactions_with_Schnorr.md).
* **✅ P2WPKH (Pay to Witness Public Hash).** P2WPKH is a SegWit address that can be unlocked with a single key. This is the default address type for Bitcoin core, and what you'll mostly be using. P2WPKH deprecates P2PKH.
* **✅ P2WSH (Pay to Witness Script Hash).** P2WSH is a SegWit address that can be unlocked a script (rather than one or more private keys doing so). Scripts are described in [Chapter 11](11_0_Introducing_Bitcoin_Scripts.md) (and afterward). P2WSH deprecates P2SH.
* **✅ P2TR.** Taproot is the newest Bitcoin address type, but it was soft forked back in 2021, so it should have wide acceptance at this point. It's considered the next iteration of SegWit. It can produce smaller transactions for multisigs, has privacy advantages, and can also combine singular signatures with scripts. It hasn't been widely adopted yet. We'll examing Taproot transcations starting in [Chapter 9](09_0_Expanding_Bitcoin_Transactions_with_Schnorr.md).
The following two address types are not in wide use, but still hold large amounts of old funds:
The addresses that have been deprecated are:
* **❌ P2PK (Pay to Public Key).** This address type was used in the earliest days of Bitcoin and quickly deprecated. Revealing your public key can actually be dangerous since quantum computing or other future processor improvements might be able to brute force a private key given a public key. That's why modern addresses are based on a hash of your public key, instead of the public key itself, and why P2PK was quickly phased out.
* **❌ P2MS (Pay to Multisig).** Most Bitcoin transactions are signed by a single key, which allows a single person to decide to send the Bitcoin. Multisigs instead allow multiple people to do so. P2MS was the initial attempt to support this, but it exposed public keys (like P2PK). It was quickly replaced by P2SH scripts, and more recently by P2WSH and P2TR.
* **❌ P2PKH (Pay to Public Key Hash).** The P2PKH address was the predominent address type prior to the introduction of SegWit, which replaced it with P2WKH. Most new addresses are now created with P2WPKH, since their transactions are cheaper, but many older P2PKH addresses still hold funds, since it was in use for roughly a decade.
* **❌ P2SH (Pay to Script Hash).** P2SH was the first type of scripting address, before signatures got reached for SegWit, resulting in P2WSH.
* **❌ P2SH (Pay to Script Hash).** P2SH was the first type of scripting address, before signatures got revamped for SegWit, resulting in P2WSH.
These last four address types are more totally deprecated:
* **❌ P2PK (Pay to Public Key).** This address type was used in the earliest days of Bitcoin and soon phased out. It pays directly to a public key, rather than the hash of a public key. Revealing your public key can actually be dangerous since quantum computing or other future processor improvements might be able to brute force a private key given a public key. That's why modern addresses moved to those hashes, which can't be reversed.
* **❌ P2MS (Pay to Multisig).** Most Bitcoin transactions are signed by a single key, which allows a single person to decide to send the Bitcoin. Multisigs instead allow multiple people to do so. P2MS was the initial attempt to support this, but it exposed public keys (like P2PK did) and only allowed a maximum of three signatures. It was quickly replaced by P2SH scripts, and more recently by P2WSH and P2TR.
* **❌ P2SH-P2WPKH and ❌P2SH-P2WSH.** When SegWit was being deployed, people wanted to send to it even before their wallets had been upgraded. These two "Nested Segwit" or "Wrapped Address" types offered the opportunity to do so by using a classic P2SH (scripting) address to incorporate the SegWit mechanics. These are actually just P2SH addresses with specific scripts, not a proper address type, and they're no longer needed since the SegWit upgrade is long past.
[Unchained Capital](https://www.unchained.com/blog/bitcoin-address-types-compared) has conducted a survey of address types that they most recently updated in 2025. Besides giving more details on all of address types, it also listed how much of the Bitcoin supply was held in each address type. Though some deprecated addresses (mainly P2PKH) still hold large amounts of Bitcoin, that's a historic artifact. Some funds may be forever lost (due to lost keys) while others may be being held for the long term.
[Unchained Capital](https://www.unchained.com/blog/bitcoin-address-types-compared) conducted a survey of address types back in 2023. Besides giving more details on all of the address types, it also lists how much of the Bitcoin supply is held in each address type. Though some deprecated addresses (particularly P2PKH and P2SH) still hold large amounts of Bitcoin, that's a historic artifact. Some of those funds may be forever lost (due to lost keys) while others may be being held for the long term.
| Type | Description | Fund % |
|------|-------------|--------|
@ -58,7 +59,7 @@ The addresses that have been deprecated are:
## Understand Address Prefixes
Each different type of address is formed in a different way. An address can be derived in a different way, encoded in a different way, or formatted in a different way. As a result, addresses have different lengths and look different. Part of that formatting tends to be a prefix, which helps to identify an address type at a glance. Sometimes that prefix is different for mainnet and for the various testing networks (signet, testnet, regtest) so that you don't confuse fake funds and real funds.
Each different type of address is formed in a different way. An address can be derived in a different way, encoded in a different way, or formatted in a different way. As a result, addresses have different lengths and look different. Part of that formatting tends to be a prefix, which helps to identify an address type at a glance. The prefix is always different for mainnet and for the various testing networks (signet, testnet, regtest) so that you don't confuse fake funds and real funds.
The following chart lists out the prefixes and encoding methods for each address type: