What is a bitcoin address and how do they work?

Originally published on the Unchained blog.

If you’re new to bitcoin or have only ever traded bitcoin on an exchange, you may be unfamiliar with bitcoin addresses. However, they are an essential part of using bitcoin, especially if you plan on taking self-custody of your coins. Anyone using bitcoin should learn what addresses are and how they work, so they can send and receive with confidence!

What is a bitcoin address?

A bitcoin address is an alphanumeric string used for receiving bitcoin to your wallet. You can think of it like an email address—anyone with one of your bitcoin addresses can send you bitcoin, just like anyone who has one of your email addresses can send you an email. Let’s go over what bitcoin addresses look like and how to use them.

What do bitcoin addresses look like?

A bitcoin address looks like a long string of letters and numbers. Here are some examples:

  • 1LMcKyPmwebfygoeZP8E9jAMS2BcgH3Yip

  • 3E13MQrZvPHqSSTsdQaZzZiYPzjEDT5VKE

  • bc1qsr03qya584vkdqztxyat3d5s63pjfddy8vwrue

  • bc1qzyda53xqwkqruex3mzwvpja04x23r572mygpgfc90qckdw2cwwaqr2h70u

All mainnet bitcoin addresses begin with a prefix of 1, 3, or bc1. You may notice that some of these addresses are longer and don’t include any capital letters. This is because they are using a different address format called Bech32. Despite the alternative formatting, these addresses are used in the same way, and the typical bitcoin user doesn’t need to treat “bc1” addresses any differently.

A bitcoin address as shown in QR form on a mobile wallet.

Addresses can also be expressed as QR codes. This helps share addresses with other people. For example, certain apps can use a phone’s camera to scan a QR code from another person’s phone, a computer screen, or printed paper.

Lightning invoices are not addresses

An alternative way to transact with bitcoin is using a second-layer solution called the Lightning Network. These transactions do not occur on the blockchain, and they don’t use bitcoin addresses.

Instead, the Lightning Network uses a system of invoices as the primary method for transferring bitcoin from one person to another. The receiver generates an invoice for a particular amount and then provides the invoice to the sender, who then has the option to pay it. Lightning invoices are much longer than bitcoin addresses, starting with the prefix ln. They also feature QR codes that are often noticeably more complex than the QR codes used for bitcoin addresses:

A lightning invoice as shown in QR form on a mobile wallet.

More recently, “Lightning addresses” (commonly formatted to look like an email address) have also begun to emerge, and they too are not to be confused with bitcoin addresses.

How to use a bitcoin address

Addresses are used for all typical bitcoin transactions occurring on the blockchain. They represent the destination for the bitcoin that is being moved. If you want to send bitcoin to someone else, they must provide you with an address. Conversely, if someone wants to send bitcoin to you, you will need to give them an address. The following are some tangible best practices to follow when using addresses. 

Always use a new address

Your wallet doesn’t have just one address—it can generate many different addresses that all point to the same wallet. In fact, you can generate thousands of addresses, more than you will ever need!

But why would you want to use more than one address to receive bitcoin to your wallet? The answer is privacy. Since the bitcoin blockchain is intentionally transparent, the bitcoin balance on each address is public and easily searchable (much like you would use google to search for a website). If someone learns that an address belongs to you (maybe you gave them an address so they can send you bitcoin), then that person can track the balance on that address going forward. Therefore, using new addresses to receive bitcoin from other people is recommended, as outlined in our article covering privacy basics.

Ensure the address is correct

As shown earlier, bitcoin addresses look like a series of random numbers and letters, and each character is essential. If an address is altered, the result will no longer represent the intended destination. As we noted in our article covering 21 of the most common ways to lose bitcoin, funds sent to a different address by mistake will almost certainly be unrecoverable.

For this reason, when transferring addresses from one place to another, you should always use QR codes or a copy-and-paste procedure. Using a hardware wallet to verify an address and conducting a small test transaction can provide additional confidence when confirming address accuracy.

What is a bitcoin address checksum?

Thankfully, bitcoin addresses also include a highly effective safety net to help you avoid typos. Each address’s last few characters are a checksum, created by hashing the preceding data. In layman’s terms, if you take a valid address and alter it even slightly, perhaps just changing one of the characters, it will almost certainly become invalid. The chances that your alteration could result in a different valid address are less than 1 in 4,000,000,000 (or impossible, depending on which character is altered).

How many characters of my address do I need to check?

Because of the checksum, when an address is copied to a different location, it is unnecessary to check that every letter and number was transferred correctly. It wouldn’t hurt to do so, but a commonly recommended shortcut is double-checking the address’s first six characters and the last six characters. If those characters appear as expected and the address remains valid, you can be confident that you did not make a mistake. You should still check the full address manually if you believe a sophisticated attacker is trying to steal your bitcoin.

How are bitcoin addresses created?

When a new wallet is created, all of the addresses to that wallet can be immediately calculated, even if the wallet was constructed completely offline. Let’s shed some light on how that works!

Addresses are built from public keys

Suppose someone wants to build an address to be able to receive bitcoin, but they are starting from scratch. Typically, the first step would be randomly generating a seed, which can also be expressed as a seed phrase. The user would want to keep the private key secure and private because it could be used later on to approve spending bitcoin received to the address. The safest way to generate a private key is by using a hardware wallet.

The seed can then be used to create a master public key and extended public keys, also known as xpubs. The same private key can generate as many different xpubs as you would like. They are the main ingredient for creating wallets, and since you can create multiple xpubs from one private key, your private key can be used to build many separate wallets! If you would like to learn more about extended public keys, Justin Moore wrote a great article that nicely compliments this one.

Once you have an xpub, you can use it to generate as many regular public keys as you would like. Each individual public key can then be used to create a unique address! 

A simplified representation of how keys are used to create addresses.

If you grab a public key from just one xpub, then your address will belong to a single-signature wallet. If you instead create an address by combining multiple public keys from several xpubs and several private keys, then your address will belong to a multisig wallet.

Additional components of an address

Once you have the public key(s) you will use for your address, the remaining necessary elements are the prefix and the checksum.

Advanced bitcoin users can also include additional instructions within certain addresses, so that conditions must be met to spend the bitcoin beyond signatures from private keys. For example, someone could create an address so that bitcoin received to that address could only be spent after a certain amount of time, or upon solving a math problem, among other things.

Previous
Previous

Bitcoin address types compared: P2PKH, P2SH, P2WPKH, and more

Next
Next

Managing UTXOs and addresses to preserve privacy in a bitcoin economy