How Are Bitcoin Wallet Addresses Generated?

|
Want to learn more about crypto?
Explore more on our blog!
Learn more
Bitcoin wallet addresses generation methods.
Table of Contents
Bitcoin wallet addresses generation methods.

Key Takeaways:

  • Bitcoin wallets use a pair of private and public keys to generate wallet addresses
  • Bitcoin uses Public-Key Cryptography to encrypt and decrypt data for authenticity and privacy
  • Private keys are randomly generated 256-bit hexadecimal numbers while public keys are generated mathematically using elliptic curve multiplication

How Are Bitcoin Addresses Generated?

A public key generates Bitcoin wallet addresses through the use of two cryptographic hashing algorithms.

Bitcoin wallets are used to store Bitcoin. 

This is like a bank account where we hold our fiat money. If we want to access our money, we can access our bank account and can send or receive money. 

Bitcoin wallets work in the same way. As a bank account needs an account number so that it allocates money correctly, a Bitcoin wallet needs an address, too. These addresses are created by generating a private and public key. 

The private keys are 256-bit letters and numbers with alphanumeric characters randomly chosen if you create a Bitcoin wallet. The private key then creates a public key which is used to generate a wallet address. 

These two keys form a key pair mathematically related to each other. This way the derivation of the public key from the private key. The public key hashes into a wallet address. 

If you want to receive bitcoin in your wallet, you always have to provide this wallet address to the sender. This entire process is a cryptographic method called ‘Public-Key Cryptography’. 

In the following article, we will look at how these cryptographic processes work.

Why BTC Uses Public-Key Cryptography?

Bitcoin uses Public-Key Cryptography.

It is a more advanced encryption method allowing easy verification of authenticity.

In comparison with symmetric encryption, Public-Key Cryptography is a method of asymmetric encryption.

Instead of using only one key to decrypt data, it uses two separate keys

There is always a private key needed to decrypt data. With Public-Key Cryptography there is also a public key used. The public key is available to the public so anyone can use it to encrypt data. There is no need to send private keys to other persons.

This could be another privacy risk. Someone could steal the private key, allowing this person to decrypt the data. With public keys, this problem does not happen. The public key encrypts data and anyone can use it. A private key decrypts this data. 

Only one person has the private key and should not share it with anyone. The private key allows the Bitcoin user to verify that he is the actual owner of the bitcoin stored in the wallet because only he has access to it. 

The entire process of creating Bitcoin wallet addresses starts with the creation of private keys. These keys then generate the public keys and the wallet addresses, too.

How is a Private Key Generated?

A private key is a randomly generated hexadecimal 256-bit number.

First, a number generator picks in the Bitcoin network a random decimal number between 1 and 2^256.

It puts this large number through the SHA-256 algorithm (Secure Hash Algorithm with 256 bit length). This creates a private key in a hexadecimal format.

Together with the digits from 0 to 9, it additionally uses the letters A to F. A hexadecimal digit can have 16 different values instead of only ten. A private key in this format looks similar to this:

036ff283158711436176

The randomly picked decimal number in the first step was further randomized by the algorithm and shortened to a usable length of 64 digits in a hexadecimal number format. 

The generated private key is the first step in the process of Bitcoin wallet address creation and is used to prove your ownership of the bitcoin within your wallet. It is an important key which every Bitcoin owner should secure as well as possible.

How is a Public Key Generated?

A public key derives from a private key and connects mathematically to it. 

A private key also generates a corresponding public key. The generation of a public key is calculated by using elliptic curve multiplication.

Elliptic curve multiplication (ECDSA, or Elliptic Curve Digital Signature Algorithm) is a mathematical process where the private key multiplies by a variable in an elliptic curve to produce an output.

It uses a defined standard called ‘secp256k1’. 

This output is another variable (the public key). We can only do this process in one way, from the private key to the public key. But it is nearly impossible to reverse this calculation. This leads to an advantage for this method.

With the private key generating a corresponding public key, we can also use the public key for verification of the same data used by a public key. This way, we can share the public key with anyone, leaving the private key secret to the user.

The public key can work as a proof that the user has the corresponding private key verifying his authenticity. And whoever has the private key can be verified as the owner of the bitcoin stored in the wallet.

How is a Bitcoin Address Finally Generated?

A public key creates a Bitcoin address using hashing algorithms to shorten it and make it more readable. 

This address is used to send and receive cryptocurrencies like a bank account number. 

It compresses the public key to make it shorter and easier to read. Two algorithms do this, the already used SHA-256 and the RIPEMD160 (RACE Integrity Primitives Evaluation Message with 160-bit length). 

First, it hashes the public key with the SHA-256 for further security reasons. Adding now another randomly generated hash minimizes the risk of duplicates and makes reversing more likely impossible.

Note that using the SHA-256 once is already considered being nearly impossible. After this process, the output is then hashed a second time using the RIPEMD160 algorithm, known as double-hashing.

This algorithm uses only 160 bits, which results in a shorter output. Shorter addresses are easier for everyday use.

To make the address more readable and error-proof, a so-called ‘Base58 Check’ is performed to encode the Bitcoin address. This encoding displays it by using more letters of the alphabet and omitting characters, which could lead to mistakes.

The characters 0 (zero), O (capital o), l (lower L) and I (capital i) are omitted because in some fonts they are displayed identically. If someone would read or type such characters, there would arise a high probability of errors.

The result of this entire process is the final address format, which then can be used for sending and receiving bitcoin. These addresses can come in different formats, like bech32, P2PKH or P2SH addresses. Their formats specify their length or their starting characters.

How Many Addresses Can a Bitcoin Wallet Have?

If you can create addresses easily, then the question arises how much of them you could have. 

In your wallet, you can have as many addresses as you want. 

This sounds hard to believe because everyone could just create endless addresses. There is no problem in doing it because the number of addresses is nearly endless and you won’t ever have to think of a limit. 

A public key creates a corresponding address with the RIPEMD160 hash. With his 160-bit, there are 2^160 addresses possible. No one can imagine this number, but it is so big that it is practically infinite. 

A wallet comes with 100 pre-generated addresses, but if you use them all, your wallet can just generate new ones.

Practically the wallet provider you choose could apply a limit to the number of addresses you can use. But apart from that, a wallet can generate addresses without a limit in amount. 

The only thing you should keep track of is that with a significant amount of addresses, it is getting harder to track them all. 

Do keep that in mind and try to track them all so you don’t get the problem of losing access to them because you forgot the correct address number.

What’s the Difference Between a Bitcoin Wallet, a Key, and a Wallet Address?

Address, key or wallet are three important terms for crypto assets. 

An address is the unique identifier used by a wallet similar to a bank account number. 

We use it as the address for every transaction within crypto wallets. A key is another unique number associated with an address and can access the funds in the wallet. 

A wallet is the actual interface to store, receive, or send bitcoin. There are different types of wallets, like hardware wallets, paper wallets or software wallets. 

The key difference to all these terms is that we use the address as the receiving address for the funds, the key provides access to those funds, and the wallet stores the funds.

FAQ

How Many Crypto Keys and Addresses Can Be Generated?

We can generate Bitcoin keys and addresses in a nearly unlimited number. 

Because of the RIPEMD160 hash function, 2^160 addresses are possible. 

This is an insane number and is so much that no person will ever have to think about a limit of keys or addresses. 

Even if you use one address per Bitcoin transaction, you never will get to a limit. With your wallet software, you can generate as many addresses as you want without restrictions. This ability secures Bitcoin. 

You can further manage multiple accounts on one wallet easily. Another reason is that this way you can maximize your anonymity. 

We can trace every address in the Bitcoin blockchain network, so if someone knows your address because you have used it in a transaction, the other person can check how much bitcoin there is on this address. 

If you use multiple addresses, you can hide your overall funds better from other people.

Why Does Bitcoin Generate New Addresses?

The Bitcoin protocol allows for this kind of generation because of different reasons. 

The most important reason is privacy. 

When a new Bitcoin address is used to receive or send funds, it doesn’t show the total number of bitcoins a user might have. 

Every address acts as a separate ‘bank account’ with their own funds. This makes it difficult to track all the funds a person could have. A separate address is useful if you want to hide your other funds. 

If you generate a new wallet address, you are further protected against theft or fraud. If someone could get access to your address, then your other addresses would remain safe and you wouldn’t lose all your money. 

Wallet software does this automatically for you known as hd wallets (hierarchical deterministic). If you want to receive bitcoins, you always get a new address generated by your wallet.

Can the Same Bitcoin Address Be Generated Twice?

Theoretically, a Bitcoin address could be generated twice, but because of the hashing process, the likelihood is so small that it is practically impossible. 

These algorithms create hashes from inputs with an extremely high number of potential outputs. 

This process is further done twice, so the same output is nearly impossible to achieve. Besides this, a public key is used for every address to minimize the possibility of duplication. 

The address derives from the public key, which adds another step into the process to create an address.

Conclusion: How Bitcoin Wallet Addresses are Generated?

Bitcoin wallet addresses are generated through a complex cryptographic process using private and public keys. 

The private key, which is a randomly generated 256-bit hexadecimal number, generates a public key using elliptic curve multiplication. 

The public key is then hashed using SHA-256 and RIPEMD160 algorithms to create a wallet address, which is used to send and receive bitcoin. 

The use of Public-Key Cryptography, a method of asymmetric encryption, adds an extra layer of security by allowing easy verification of authenticity without the need to share private keys. 

It is crucial for Bitcoin users to secure their private keys to prove ownership of their bitcoin.

Sources

Disclaimer:

The information provided on this blog is for general informational and educational purposes only. It is not intended as financial, legal, or investment advice. Cryptocurrency investments are volatile and high risk in nature; it is possible to lose your entire investment. We are not financial advisors, nor do we purport to be.

While we strive to provide accurate and up-to-date information, we cannot guarantee the accuracy, completeness, or applicability of any information provided. The views and opinions expressed on this blog are solely those of the authors and should not be construed as professional advice. We do not endorse or guarantee the performance of any cryptocurrencies, projects, or companies mentioned herein.

Readers are encouraged to conduct their own research and consult with a professional financial and legal advisor before making any investment decisions. The owner of this website and the authors of its content will not be liable for any losses, injuries, or damages from the display or use of this information. Use of this information is at your own risk.

About the Author:
Morgan Davis, an expert in digital currency and economic analysis, offers a unique perspective on cryptocurrency within the global financial landscape. With a background in International Economics, Morgan's insights delve into how macroeconomic factors influence the crypto market. Their writing simplifies complex economic and cryptocurrency concepts, making them accessible to a broad audience. Morgan is actively engaged in discussions about the impact of blockchain on finance, and their work empowers readers to understand and navigate the world of digital currencies.