The bitcoin addresses or bitcoin addresses They are a unique string of numbers and letters that allow us to send and receive our coins securely on the Bitcoin network.
How is a bitcoin address generated? What is your secret? We tell you everything about this process.
Before beginning, it is essential to mention that this article is aimed at those users who have some knowledge about Bitcoin and the crypto world. So we recommend that you review certain topics of this world in order for you to understand them. With this, you will be very clear about the relationship between Bitcoin and the creation of addresses.
Where would you have to start? We recommend that you read: asymmetric cryptography, hash function, SHA-256 algorithms, ECDSA y What is a Bitcoin address?
Well, in the world of cryptocurrencies, , an address is an identifier, the place to which a certain amount of cryptocurrencies is associated and allocated. Therefore, anyone who wants to send or receive cryptocurrencies will always need to have an address. For example, in Bitcoin public addresses generally look like this: 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa. As we can see, they are a set of alternating letters and numbers whose length varies between 26 and 32 characters.
To create an address, a total of 9 steps are required, which we will explain in detail below.
Process to create a Bitcoin address
The process to create a Bitcoin address begins with the generation of a private key which will provide us with the exclusive use of the funds. From this, a public key, which will allow us to share information with other people without putting ours at risk.
Obtaining the public key through the private key is due to the application of the algorithm ECDSA. A very efficient implementation of elliptic curve cryptography, where the curve is used as a generator point secp256k1 to get the public key.
Then, once this key pair is generated, the process of generating the public addresses of Bitcoin begins.
1.- Select the public key obtained from the previous process. That is, from the application of the algorithm ECDSA a the private key. Which should have an appearance similar to this one:
0250863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b2352
2.- Apply a hashing to the public key by implementing the algorithm SHA-256. This algorithm allows to generate outputs (outputs) of fixed extension from inputs (inputs) of variable extension, which are irreversible. So they are unidirectional and it is not possible to deduce the private key through the public one.
After applying the hashing function we will obtain a 256-bit stream:
0b7c28c9b7290c98d7438e70b3d3f7c848fbd7d1dc194ff83f4f7cc9b1378e98
3.- Hashear again the previously obtained output, applying in this case the algorithm RIPE MD-160. with which we will obtain a 160-bit stream:
f54a5851e9372b87810a8e60cdd2e7cfd80b6e31
4.- Add the version byte used for Bitcoin's core network (0x00) in front of the output obtained from the RIPEMD-160 hashing algorithm application. With this we will obtain a Bitcoin address in hexadecimal format, which will look like this:
00f54a5851e9372b87810a8e60cdd2e7cfd80b6e31
And by adding this byte we can also identify and distinguish Bitcoin addresses from other cryptocurrencies that also use the protocol.
5.- Perform the hash with the SHA-256 algorithm to the result obtained from RIPEMD-160. This step is necessary as a verification mechanism to verify that the Bitcoin address is spelled correctly.
ad3c854da227c7e99c4abfad4ea41d71311160df2e415e713318c70d67c6b41c
6.- Apply the hash with the SHA-256 algorithm to the result of the previous hash. This step concatenates the address obtained. As already mentioned, the SHA-256 algorithm is applied twice as a verification mechanism.
c7f18fe8fcbed6396741e58ad259b5cb16b7fd7f041904147ba1dcffabf747fd
7.- Choose the first 4 bytes of the last SHA-256 hash, which represent the Bitcoin address checksum. In this example they would be:
c7f18fe8
8.- Add the 4 bytes of the checksum of the previous point, to the extended hash RIPEMD-160 of point 4. This is a 25 byte Bitcoin binary address:
00f54a5851e9372b87810a8e60cdd2e7cfd80b6e31c7f18fe8
9.- Convert the result of the byte string using Base58Check encoding, used to encode Bitcoin addresses. So the byte string will be transformed into a string base58.
1PMycacnJaSqwwJqjawXBErnLsZ7RkXUAs
This is the most widely used format for Bitcoin addresses. So the encoding Base58Check converts the byte string to a set of numbers and uppercase and lowercase letters, in order to make them easier to distinguish. Although as a whole they are still illegible characters and that at first glance are not cryptic.
So you can create a bitcoin address so that we can use it as we wish. All this process is also carried out with the Vanity Address, only in this last case we perform a generation by brute force in order to search for a personalized address.
You can learn more about these types of addresses from our article about Vanity Addres.
Characteristics of Bitcoin addresses
- Each public Bitcoin address weighs approximately 25 bytes.
- They have a length of between 26 and 32 characters.
- They can start with number 1, for standard addresses (P2PKH) or number 3, for multi-signature addresses (P2SH). Also, the addresses followed start with bc1 (beach32). On the other hand, the directions Bitcoin testnet they start with m o 2.
- The implementation of Base58Check among its many functions, prevents the use of characters such as O, I (in uppercase), and l (in lowercase) in order to avoid that they are confused with the number 0 or number 1.