Get started
Get started
If you use your own Bitcoin wallet in self-custody, you must have already used a receiving address. As you probably know, these character sequences allow you to receive bitcoins on your wallet.
In this article, we are going to take a detailed look at this essential element in using Bitcoin. We explore exactly what a receiving address is and its role in the wallet. We also present the different types of addresses that exist, how each type is constructed and which one you should choose. Finally, we discuss the best practices to adopt to ensure the security of your bitcoins in self-custody.
A Bitcoin receiving address is an alphanumeric string used to receive bitcoins on a wallet, much like a mailing address that is used to receive mail. This address is the identifier that indicates where to send the BTC.
On the other hand, unlike a postal address, which remains the same for all letters received, Bitcoin wallets can generate several different receiving addresses. For privacy reasons, which we'll discuss in more detail in the final part, it's highly recommended that you use a new address for each payment received in the wallet.
Concretely, when a user wants to send bitcoins, he must know the recipient's receiving address. This address is generated by the recipient's wallet and can be communicated to the sender who will use it in his transaction.
Each receiving address is linked to a public key, which is itself associated with a private key. Once bitcoins are received at an address, the only way to spend them again is to provide cryptographic proof with the corresponding private key.
This proof takes the form of a digital signature. The person who holds the private key associated with an address is therefore in fact the owner of this address and the bitcoins sent there. This mechanism ensures that only the legitimate owner can spend the bitcoins they have previously received.
On Bitcoin, various standard script models are used to block BTC on a receiving address. Each script template meets specific needs, and new models are introduced regularly with updates.
A script template is essentially a small list of OP-codes put together to form a standard that specifies how to set up spending conditions on bitcoins. The main families of script templates, in chronological order, are:
If you use a Bitcoin wallet in self-custody, you have probably already encountered these technical terms, as you are usually asked to choose among these standards when creating your wallet. And precisely, each standard corresponds to a different type of address.
The P2PKH model (Pay-to-pubkey-hash) is the oldest. It was introduced by Satoshi Nakamoto when Bitcoin was launched. P2PKH addresses start with a “1.” For example, here is a P2PKH receiving address:
1htZQJS6YUUPIGNNPC9425xENXQS2JwM7C
Introduced a few years later, the P2SH model (Pay-to-Script-Hash) allows you to encode an expense script for more complex transactions, such as multi-signature wallets. P2SH addresses always start with a “3,” for example:
3ge7gubm1MFUUT7T1bIDjwcm75owvxfbwp
These two models are part of the “Legacy” standard and are now considered obsolete. Their use is no longer recommended. They don't present a security problem, but they cost more and are less confidential than modern standards.
The P2SH-P2WPKH and P2SH-P2WSH addresses are transition solutions for SegWit compatibility. These specific script templates encapsulate a SegWit address into a P2SH address, in order to allow users to benefit from the benefits of SegWit while remaining compatible with older software. These addresses are the same as P2SH addresses and so they start with a “3”. This standard is called “Nested-Segwit”, which is no longer necessary given the wide adoption of SegWit.
P2WPKH (Pay-to-Witness-Pubkey-Hash) and P2WSH (Pay-to-Witness-Script-Hash) are the native SegWit formats. As a user, you can absolutely choose to use this standard, although I recommend using Taproot addresses instead from now on. P2WPKH addresses start with “bc1q” and allow the user to save on transaction fees. P2WSH addresses also start with “bc1q” and are used for more complex scripts, such as multisignatures. For example, here is a SegWit address:
bc1qtcstnrarj7ennfsu4fjtlmdw3gu3w833jgvhrt
Finally, the P2TR scripts (Pay-to-Taproot), introduced with Taproot in 2021, represent the most recent model. The use of P2TR addresses not only saves costs, but also improves confidentiality, especially for complex scripts. P2TR addresses always start with “bc1p”, for example:
bc1ph540qgndfedhnhfyq36z7d6fsk278ca0sgsmexnz377v633e7e7slqp7lnjn
But in concrete terms, how are these receiving addresses generated by wallets?
The construction of a receiving address depends on the type of script used. For the P2PKH and P2WPKH models, addresses are simply the user's public key hash. Your Bitcoin wallet generates numerous pairs of cryptographic keys based on your mnemonic phrase (12 or 24 words). Each pair consists of a private key, used to spend the funds, and a public key, used to receive them. To form a receiving address, the public key is simply passed into a hash function.
This part makes up what's called the address payload. To this, certain metadata is then added, such as the “bc1q” prefix for SegWit addresses, for example. A checksum (or checksum) is also added.
For the P2SH and P2WSH models, as their names indicate, the addresses are the result of the hashing of the script used. For the rest, the construction is identical.
As for P2TR addresses, their construction differs slightly: the address is not the hash of a public key, but rather the public key itself, presented in its raw form. For those who want to deepen their understanding of how Taproot addresses work, I invite you to consult our article dedicated to this subject.
Once all the information needed to build an address is gathered, it is then encoded in a specific format adapted to Bitcoin. Three formats are used:
These formats are simply a standard way of writing addresses so that they are human-readable and uniformly recognized by different wallet software and platforms such as Bitstack.
To block bitcoins, the address payload is integrated into a script that locks the funds. This script is usually called” ScriptPubKey ” or” Locking Script ”.
As we saw in the previous part, Bitcoin receiving addresses incorporate a checksum. This value, calculated from the address itself, is added at the end of the address to ensure its integrity and validity during transmission.
This checksum is important because it allows software to verify the accuracy of the address entered when sending Bitcoin. For example, with the Bitstack app, if you attempt to withdraw your bitcoins to another wallet and make a mistake entering the address, the app won't let you send your funds because the address is invalid. This verification is made possible thanks to the checksum.
This feature eliminates the need to carefully check each character of the receiving address when it is transmitted to a sender. Just check a few characters at the beginning, middle, and end of the address to make sure it's the right one. If there is a typo, such as a missing or extra character, the sender's software will prevent the transaction from being sent.
So much for the security of Bitcoin receiving addresses. For privacy, it's important to understand that addresses should only be used once. This means that for each new incoming transaction, you need to generate a new address.
Since the blockchain is public, it is easy to see which addresses secure what quantity of bitcoins. If the same address is used for several transactions, it is then possible to deduce that all the bitcoins associated with this address belong to the same person. This phenomenon of address reuse compromises the user's privacy, by making it possible to make deterministic links between different transactions and by facilitating the tracking of bitcoins on the blockchain. Satoshi Nakamoto himself already highlighted this problem in his white paper:
As an additional firewall, a new key pair could be used for each transaction to keep them unlinked to a common owner.
- Nakamoto, S. (2008). “Bitcoin: A Peer-to-Peer Electronic Cash System.” https://bitcoin.org/bitcoin.pdf.
To best protect your privacy, it is highly recommended that you use each Bitcoin address only once. Fortunately, with deterministic and hierarchical wallets, it is now very easy to manage multiple addresses. All key pairs associated with a wallet can be easily regenerated based on your mnemonic phrase. It is precisely for this reason that wallet software automatically offers you a new address each time you press the “” button. Receiving ”.
➤ Discover 7 tips to improve the security of your Bitcoin wallet.
A Bitcoin address is a string of characters generally generated from a public key, used in scripts to block bitcoins. In other words, it is used to receive bitcoins.
There are several types of Bitcoin addresses, each corresponding to a different standard. Nowadays, it is recommended to use Taproot P2TR addresses, or failing that, SegWit P2WPKH addresses.
For the user, the most important aspect when using receiving addresses is to never reuse the same address for multiple transactions. It is essential to generate a new address for each transaction, otherwise the lack of confidentiality provided by Bitcoin is completely destroyed.