How are Bitcoin addresses created?

How are Bitcoin addresses created?

8:00 in ▪
min read ▪ with
Nicholas T.

Addresses are at the heart of how Bitcoin transactions work. They are public key encodings.

From the public key to the address

Generating a Bitcoin address requires above all a public key which goes hand in hand with a private key.

The two keys are created together using elliptic curve cryptography. The curve used in the Bitcoin protocol is called secp256k1.

Keys are essentially large numbers connected by a mathematical relationship obtained through this elliptic curve.

The equation of the elliptic curve secp256k1 is that each of the keys obtained is at most 256 bits. Instead of expressing it in figures, we use the hexadecimal format. We are talking about base16 format (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F).

256-bit hex keys are 64 characters long. Example of a private key in hexadecimal:


In decimal (base 10):


In binary (base2):




The key expressed in binary is 256 bits (256 0 or 1), you can count.

The corresponding public key (in hexadecimal) is:


Public keys are often confused with addresses by mistake. Addresses have long been used instead of public keys to perform transactions.

Public keys are now hidden behind “addresses”. Here is the process to convert a public key into an address:

1) Pass the public key in SHA-256.

2) Pass the hash found in RIPEMD-160 (which also has a hash function).

3) Put at the beginning of this hash the code corresponding to the type of address.

4) Pass everything through SHA-256.

5) Run through the SHA-256 grinder again.

6) Take the first four bytes of the hash (check) and add them to the hash obtained in step 3. You will then receive a 25-bit bitcoin address.

7) Convert the address to base58 format.

What is SHA-256, RIPEMD-160, Base58?

Replace “Secure-Hash Algorithm” with SHA-256. This function returns a 256 bit hash of whatever is given as input.

This is a one-way function. So it is not possible to guess what was given as input from the output hash.

If we give as input “I likeBitcoin” in SHA-256, we get this hash:


If we say “I like bitcoin” instead (with lower case b), we get this hash:


The hash is completely different. This is known as the “avalanche effect”. A very small input modulation changes the output result significantly.

RIPEM-160 is also a hashing algorithm. Except that the length of the hash is only 160 bits.

Why use two different algorithms?

RIPEMD-160 shortens the size of hashes. This reduces the amount of memory required to run a node. This reinforces the decentralization of the web. This makes transactions less complex and therefore cheaper.

SHA-256 adds a level of security, against the quantum threat for example.

Base58 is used to remove the characters 0, O, I and la. This avoids errors by misplacing them when reading the address. It also shortens the length of the address a little more.

Finally, the address type code to distinguish between different types of addresses. Full list HERE.

Example of address creation

You must initialize a public key:


1) Enter the public key in SHA-256 which will give a 256-bit hash:


2) Enter this hash into RIPEMD-160 (which is also a hash function that gives a 160-bit hash):


3) Add the transaction type code to the beginning of the hash from RIPEMD-160:


4) Go back to SHA-256:


5) Go back a second in SHA-256:


6) Take the first four bytes of the hash (check) and add them to the hash obtained in step 3. Then you get a 25-bit bitcoin address:


7) Convert the address to base58 format.


So. It looks a lot like one of the addresses in your wallet, doesn’t it?

By the way, the “check” allows the wallet to check if there is a typo in the address provided. ​​​​​​It would be a shame to send BTC to the wrong address.

Thanks to the check, the probability of entering an incorrect address is only 1 in 4.3 billion. So don’t worry about entering the wrong key.

Furthermore, the number of Bitcoin key pairs that can be created is 2^160. The probability of a lucky person getting these BTCs is almost zero. BTC will be lost forever.


There are different types of addresses. The one we described is called a P2PKH (Pay-to-public-key-hash) or “Legacy” address. This is the oldest type of address. They start with “1”.

There are many other types of addresses, such as:

-The addresses P2WPKH (Pay with Witnesses-Public-Key-Hash). They are encoded in Bech32 rather than base58 and start with “bc1”.
-The addresses P2SH (Pay-to-Script-Hash). They start with “3”.

Briefly, a private/public key pair is generated using elliptic curve cryptography. The public key then goes through SHA-256, RIPEMD-160 and base58 milling to create an address. This is a representation of the public key.

A set of addresses is called a “wallet”. The latter does not host bitcoins per se, but private keys.

Addresses are publicly available information used to complete transactions. Note that, concretely, a transaction is the creation of one (or more) UTXO.

UTXOs (small pieces of code) are scripts that link a certain amount of BTC to an address (public key) that the nodes jealously guard in memory. More information: UTXO and Privacy.

Only the one with the private key corresponding to the public key can unlock (sign) the script and make a transaction, ie connect the BTCs to a new address.

Get a summary of the news in the world of cryptocurrencies by subscribing to our new service newsletter daily and weekly so you don’t miss any of the essential Cointribune!

Nicolas T. avatar

Nicholas T.

Journalist reporting on the Bitcoin revolution. My papers deal with bitcoin through geopolitical, economic and libertarian prisms.

Miner preparing for Bitcoin Halving as other cryptocurrencies rise

Bitcoin Price Pumps Above $31,000 – Can It Continue Now? –

Litecoin heizt sich auf, Kurs pumpt! Neue Prognose sieht baldige 48%-Rallye kommen

Is it too late to buy Litecoin? Course increases by 20%! Alternative AI Crypto Platform yPredict Raises $2.7M