Bitcoin, the pioneering cryptocurrency, has undergone significant evolution since its inception in 2009. A crucial aspect of this evolution involves the way Bitcoin addresses are formatted. These addresses, essentially your public keys, are used to receive Bitcoin transactions. Over time, new address formats have been introduced to improve efficiency, security, and compatibility with emerging technologies.
The Legacy: P2PKH Addresses (Legacy/v1)
The earliest and most recognizable Bitcoin address format is the Pay-to-Public-Key-Hash (P2PKH) address, often referred to as "legacy" or "v1." These addresses commonly start with the number "1" (e.g., 1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2). P2PKH addresses are relatively straightforward, encoding the public key hash directly. However, they have some limitations:
- Size: Compared to newer formats, P2PKH addresses are relatively long, adding to transaction sizes and fees.
- Limited Features: They lack advanced features like multisignature support or Segregated Witness (SegWit) compatibility from the start.
- Susceptibility to Tx malleability: They are more susceptible to transaction malleability than some of the newer address formats.
Stepping Up: P2SH Addresses (Compatibility/v2)
To address some of the limitations of P2PKH, Pay-to-Script-Hash (P2SH) addresses were introduced. P2SH addresses begin with the number "3" (e.g., 3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy). Instead of directly encoding the public key hash, P2SH encodes a hash of a redeem script. This redeem script defines the conditions required to spend the Bitcoin.
P2SH brought several advantages:
- Complex Scripts: It enabled more complex spending conditions, such as multisignature transactions (requiring multiple keys to authorize a transaction) and timelock features.
- Multi-Sig Support: It simplifies multisignature transactions for senders, by abstracting complex redeem scripts.
- Reduced Sender Computational Costs: It moved computational requirements required to validate spending conditions from the sender to the receiver
of the transaction.
While P2SH was a significant improvement, it wasn’t without its drawbacks. The reliance on scripts added complexity, which presented potential security risks.
Efficiency and Security: P2WPKH and P2WSH (SegWit/v0)
The introduction of Segregated Witness (SegWit) in 2017 brought about a new address format: Pay-to-Witness-Public-Key-Hash (P2WPKH) and Pay-to-Witness-Script-Hash (P2WSH). These are native SegWit formats. They are most commonly used within P2SH wrappers to create P2SH-P2WPKH and P2SH-P2WSH addresses, starting with "3". However, native SegWit addresses, also known as bech32 addresses, were also introduced using a different format.
These native segwit addresses offer considerable improvements:
- Transaction Fee Reduction: SegWit reduced transaction sizes by moving the witness data (signatures) outside the main transaction block. This leads to a lower transaction fee for users.
- Transaction malleability Fix: SegWit fixed transaction malleability by making the signature unchangeable.
- Increased Transaction Throughput: By reducing the size of transactions, SegWit indirectly increases the capacity of the Bitcoin network, handling more transactions per block and higher throughput.
Bech32: Native SegWit (Modern/bech32)
Bech32 addresses, typically starting with "bc1q" for mainnet transactions (e.g., bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq), are the native implementation of SegWit. These addresses provide greater efficiency and error detection compared to older formats. Bech32 uses lowercase characters, reducing the risk of typos during manual entry. Bech32m addresses start with "bc1p".
Benefits of Bech32 Addresses:
- Compact Encoding: These addresses are generally shorter than P2PKH or P2SH addresses, reducing transaction size and improving efficiency.
- Error Detection: Bech32 incorporates error detection and correction codes making it easier to identify errors during address entry.
- Lowercase Convention: Only using lowercase makes them less susceptible to uppercase/lowercase errors.
The Future of Bitcoin Addresses
The evolution of Bitcoin address formats reflects continuous efforts to improve the efficiency, security, and scalability of the Bitcoin network. While older formats like P2PKH and P2SH continue to be supported for backward compatibility, the industry is actively moving toward adopting more advanced, more efficient types such as Bech32. Future developments may include even more innovative address formats designed to enhance privacy, security, and functionality, ensuring Bitcoin remains at the forefront of cryptocurrency technology.