1. Legacy (P2PKH) format of bitcoin address
For example: 1Fh7ajXabJBpZPZw8bjD3QU4CuQ3pRty9u
P2PKH is an abbreviation for Pay To PubKey Hash.
2. Bitcoin address in Nested SegWit (P2SH) format
For example: 3KF9nXowQ4asSGxRRzeiTpDjMuwM2nypAN
Nested P2SH, which takes an existing P2SH address (starting with "3") and wraps it with a SegWit address. . This is to make it compatible with older versions. However, this is some sort of hack that causes SegWit transactions to require about 10% more space.
SegWit stands for Segregated Witness, where Segregated means separated, isolated, and Witness is the signed thing associated with a transaction. Thus, SegWit is the separation of certain transaction signature data from the transaction. segWit has been activated on the Bitcoin blockchain.
The main benefit of separating signature and transaction-related data is that it reduces the size of the data stored in a bitcoin block. This gives each block extra capacity to store more transactions. It also means that the network can handle more transactions and the sender pays a lower fee. So, if you want to reduce fees when sending bitcoins, use SegWit addresses to receive them.
Another major benefit of SegWit addresses is that they are backwards compatible, so it is possible to interchange bitcoins from SegWit addresses with bitcoins from Legacy addresses.
3. Bitcoin address in Native SegWit (Bech32) format
For example: bc1qf3uwcxaz779nxedw0wry89v9cjh9w2xylnmqc3
Addresses begin with "bc1", the Bech32 encoded address format developed for SegWit. avoiding confusion and being more readable. Because fewer characters are required in the address, it is easier and more efficient to calculate the address using Base32 encoding rather than the traditional Base58. The data can be stored more tightly in the QR code, and Bech32 provides greater security with better optimized checksum and error detection codes to minimize the chance of invalid addresses.
The Bech32 address itself is compatible with SegWit. No additional space is needed to put SegWit addresses into P2SH addresses, so the processing fee is lower with Bech32 format addresses.
How to add different btc address formats ？