A Bitcoin address is an identifier of 26-35 alphanumeric characters that is used to receive bitcoin. There are several address formats based on different specifications. Users need to know this information during backup for future recovery so applications should inform users which format it uses as support varies across applications.
When users enter an address, these formats have specific prefixes so it is possible to instantly determine which format is being used.
These are the three most common ones:
Legacy address - P2PKH
Stands for pay-to-pubkey-hash, i.e pay to a hash of the recipient’s public key. This was the original address format for bitcoin and is often called legacy address.
Legacy addresses begin with the number 1, can contain upper and lowercase characters, and are case sensitive.
Script address - P2SH
A script address can have code attached to enable additional rules and functionality. P2SH stands for pay-to-script-hash, and was defined in BIP13. Script addresses are most commonly used for multi-sig addresses which can specify, for example, that signatures from several keys are required to authorize the transaction.
Script addresses start with the number 3, can contain upper and lowercase characters, and are case sensitive.
SegWit address - Bech32
The SegWit address format (for segregated witness) was introduced in an update to the Bitcoin protocol that made changes to the transaction format. The technical name of this address format is Bech32, and is specified in BIP173. SegWit addresses are supported by the majority of software and hardware wallets, but a minority of exchanges. SegWit address adoption by applications and exchanges is tracked on this page. Any new bitcoin-application should support the use of SegWit addresses.
The benefits of SegWit addresses include more resistance to input errors (as they are case insensitive and use error-correcting codes), and lower transaction fees. The fee saving will depend on the type of transaction but for a common transfer of funds it can be in the 30-40% range.
SegWit addresses start with
bc1 and are case insensitive.
When the output of a transaction is used as the input of another transaction, it must be spent in its entirety. Sometimes the value of the output is higher than what the user wishes to pay. In this case, the bitcoin client generates a new Bitcoin address, and sends the difference back to this address. This is known as change address.
Address compatibility #
Since “legacy” addresses are still in use1, and some older applications have yet to upgrade. Script addresses can be used to resolve incompatibility issues that can arise when the sender’s application does not recognize the SegWit address provided by the receiver.
To illustrate the problem, suppose the sender is using a legacy wallet and paying to the receiver’s SegWit address. In this case, the sender’s wallet may incorrectly warn them that the address is invalid or not supported. This can confuse the sender’s end, leading them to think that the receiver provided an incorrect address.
The receiver should then have the ability to switch to a Script address that does not have all the benefits of SegWit, like cheaper transactions but will be compatible with the sender’s wallet.