We have already discussed the types and examples of Bitcoin transactions. Here you can read about how the Bitcoin transaction works. Today we’ll explain the working principle of Bitcoin address. How many bitcoin addresses are there? Do bitcoin wallet addresses change? What do bitcoin addresses look like and how is it generated? Let’s focus on the theme.
What Is Bitcoin Address?
A Bitcoin address, a public address or just an address is a unique identifier that serves as a place to send Bitcoins. It is also sometimes called the receiving address and represents the source and destination of the payment in Bitcoins.
You can share your BTC address with others and ask them to send Bitcoin to your address. It is very similar to your bank account number, which you use to receive, send and manage money.
Each Bitcoin address is unique. It consists of 26–35 alphanumeric characters, and the address usually starts with the numbers 1 or 3.
What Is a Legacy Bitcoin Address?
The legacy address is the standard address for the bitcoin network proposed by Satoshi Nakamoto. Otherwise, this format is called P2PKH (Pay To Public Key Hash), because it requires the recipient to sign a signature calculated from the private key and the public key. The script of the exit transaction using cryptographic functions checks them against the hash of the public key. If it does, it allows you to spend money.
The probability that the system will accept an incorrectly entered address is 1 in 232 degrees, that is, one case out of 4.29 billion. The legacy address can be recognized by the prefix 1 (and m or n in the test network). The main disadvantages of this address include case sensitivity when entering data, higher transaction fees, low double hash speed of the checksum, more weight in QR codes and the inconvenience of writing on a mobile device or on paper.
Example of legacy address:
Legacy addresses are unique, typically 26-35 characters long and are 160-bit ECDSA public key hashes of the key pair. With the advent of SegWit addresses, they began to be called old. Still, initially, they were a reasonably effective means of representing locking scripts in a more user-friendly way and reduce the risk of sending funds to an incorrect address. The standard bitcoin address consists of the following parts:
the public key generated by applying the SHA256 and RIPEMD algorithms to the private key;
If during the conversion of the private key at the beginning of the result zeros appear, they are not included in the string of bitcoin addresses in a legacy format. Then it is reduced by the corresponding number of characters. Therefore, the bitcoin address may not consist of 34, but theoretically, even of 20 characters.
All parts of the legacy bitcoin address are encrypted with typos protection using the Base58Check encoding system. The code is based on the Latin alphabet. You will never see symbols in such a bitcoin address that can be easily confused with each other (plus and minus signs, slash, zero, uppercase letters “o” and “i”, lowercase “L”). According to Base58Check, only the following 58 characters are used in them:
P2SH addresses (Pay to script hash) appeared in the proposal to improve bitcoin BIP-0016 in January 2012 thanks to the chief researcher of the Bitcoin Foundation Gavin Andresen. They have the same structure as legacy addresses but begin with the number 3. Such addresses assume that the recipient must have a script that matches the hash script when transferring funds. This feature allows you to reduce the commission for the transfer of bitcoins by the sender, shift the commission costs to the recipient and create addresses with multi-signature.
P2SH technology can allow the use of funds by any user or prohibit for everyone. It is important to remember that bitcoin addresses in P2SH format support SegWit, but are not its native solution. Crypto wallets that do not support SegWit can conduct SegWit transactions thanks to the P2WPKH-in-P2SH and P2WSH-in-P2SH mechanisms.
An example of a P2SH address:
What Is a SegWit Bitcoin Address?
In the spring of 2016, developers Peter Velle and Greg Maxwell in the BIP-0173 update proposed a new address format: Bech32 (often called a SegWit address, P2WPKH – Pay To Witness Public Key Hash). The SegWit protocol itself (Segregated Witness, “Separated Witness”) suggested reducing the block size in the Bitcoin network by removing the signature from it and was activated at the end of August 2017.
SegWit addresses start with bc1 (in the test network with tb), contain up to 90 characters (more often about 42), and are written either only in upper (for QR codes) or only in lower case (preferred). SegWit Addresses consist of:
data and checksum.
If up to four errors were made while entering the address, the checksum included in the Bech32 address would not converge. Thanks to the Bowes-Chowdhury-Hawkingham code (BCH code) used in the solution, the errors will be automatically corrected.
When writing a Bech32 address, the following 32 characters are used:
Example Bech32 Address:
With new addresses, QR codes have become smaller, and error protection is higher. In addition, the use of Bitcoin addresses in Bech32 format is more profitable for users today, because the fee for sending funds from them is lower and the processing speed is higher.
The main disadvantage of Bech32 addresses is that not all crypto-wallets and services support them. Among the first, support for such addresses was added by hardware crypto-wallets Ledger Nano S, TREZOR and Digital Bitbox, desktop crypto-wallets Electrum and Armory, mobile crypto-wallets Edge, GreenAddress (for iOS and Android- devices), as well as Samourai Wallet, Wasabi Wallet, GreenBits, and Electrum (for Android devices).
Is it possible to transfer Bitcoins from a legacy address to a SegWit address?
Activating SegWit on the Bitcoin network was a soft fork. This means that the new and previous versions retained compatibility. So you can quickly transfer funds from legacy addresses to SegWit addresses.
At the blockchain level, there are no problems with the difference in address formats. In practice, difficulties arise if the user wants to transfer funds from his legacy address, for example, created on the cryptocurrency exchange, to the bc1 address, and the marketplace has not yet technically implemented support for the new address format. In this case, it is worth using a less effective than bc1-, but still more advanced than a legacy-P2SH address.
In the opposite direction, from the bc1 address to the legacy address, funds should arrive without problems.
Today, bc1 addresses are parsed and indexed by Blockstream.info, Apirone.com, Bitaps.com, Bitupper Explorer, Blockchair, Blockonomics, Blockpath, BTC.com, chaindex and OXT block browsers. While Blockcypher, Insight, and Tradeblock do neither, blockchain.info does not support indexing.