What is a Bitcoin address.

in #bitcoin6 years ago

Ever wonder what all those letters and numbers really mean? This is an introduction to what a Bitcoin addresses are and how they work.

Here’s a random Bitcoin Address:

19ewDAKXkr7TfUJdmQM2LzTCuHxp8jNZG3

As you can see is a mix of numbers and letters beginning with the digit “1” (If you see a Bitcoin address not starting with “1” it may well be a new Bitcoin address generated with Segwit layer into mind — but that’s another blog post). This is the string which users send to each other in order to receive and send Bitcoin. A Bitcoin address can represent a person or something else, like a payment script (P2SH). The Bitcoin address can also be represented with a QR Code in order to make it easier to users to copy paste the value. If you’re wondering how this random string is generated keep reading!

First, we need to understand what the Public/Private Key Asymmetric Cryptographic method is and how it works.

Public key cryptography is a mathematical foundation for computer and information security. It’s a pair of keys, a private and a public one. The private key is picked randomly (more on this later) and the public key is derived from the private. In Bitcoin, the public key is used to receive funds and the private key is used to sign transactions.

How does this work for Bitcoin?

A Bitcoin user can send to another in a transaction an amount of Bitcoin and “sign” this transaction with their own private key and give his or her public key as well. Now this signature can be validated against the public key by anyone on the network (without revealing the private key) in order to check if the sender has the “right” to “spend” this amount of Bitcoin at that moment of time.
In summary, someone with the private key can sign a transaction uniquely and anyone with the public key can verify that the signature comes from someone that is the owner of the private key.
Note: for privacy and security reasons the signatures for a transaction are different each time but created from the same private key.
The relationship between the private and public key is based on a “one-way” mathematical function that is irreversible, which means that given an input you come up with an output and you cannot find the original input with the current output. Bitcoin uses the elliptic curves multiplication as the basis of its cryptography for generating secure public keys.
Once we have the public key, then we can generate the Bitcoin address by applying a one-way cryptographic Hash function to the public key.


Complete process to generate Bitcoin Address from a Private Key

It’s important to notice that there’s is no way of finding the private key with the public key nor the public key with the Bitcoin address.

Finding the Private Key

Private key in Bitcoin is just a number picked randomly between 1 and 2256, how the number is found in that range is up to the software developer. The only thing we have to take into account is that the source of randomness must have enough entropy to not be predictable or repeatable. It’s not recommended as developers to write their own random number generator nor use the programming language functions provided for this. Instead you can use a secure pseudorandom number generator that is cryptographically secure with a seed from a source of sufficient entropy.
Funny fact: If a Bitcoin address comes from a private key that can “only” be a number between 1 and 2^256, would we run out of address one day? Well, first you have to get a picture of how big 2^256 is. It is immensely ridiculous, for comparison, it is approximately 10^77 in decimal and the visible universe is estimated to contain 10^80 particules, so it’s probably safe to say that we won’t run out of bitcoin addresses. Certain calculations say that there’s approximately 1 Public address available for every 64 atoms on this planet.

Elliptic Curve Multiplication and Public Key

The mathematics behind elliptic curve multiplication is outside of the scope of this article, so we’ll just assume that applying this “one way function” over the private key we get our public key.
In this link, you will find a Bitcoin address generator, this web page asks you to move the pointer around in order to generate sufficient randomness to pick the private key, and then generates the public key and the Bitcoin address.

From Public Key to Bitcoin Address

How do we get from the Public key to the Bitcoin Address? We get it by applying a “one way hashing function” to the public key. Tired of hearing about “hashing”? Get use to! Hashing function are used all over Bitcoin and blockchain technologies (Bitcoin addresses, script addresses, Proof of work mining, etc.). In Bitcoin, the two hashing functions used for generating the btc address are the “Secure Hash Algorithm” (SHA) and the RACE Integrity Primitives Evaluation Message Digest (RIPEMD), specifically SHA256 and RIPEMD160.

So first, we hash with SHA256 the public key, and then the result is hashed again with the RIPEMD160.
The result, is the Bitcoin address, but wait!

Because there’s one more step in the process! Ha! We need to encode the resulting string as “Base58”. So what is “Base58” you might be wondering. It is a text based binary-encoding format that was developed for bitcoin use specifically, and the main objective of it is make the Bitcoin address more “human-readable” by excluding some characters that might be confusing, like the 0 (number zero), O (capital o), l (lower l), I (capital i) and the symbols “+” and “/”.

An extra layer of security is placed on the resulting Base58 string in order to prevent typos or transcription errors. Base58Check is another encoding format that has a built-in error checking code. This code is just 4 bytes added to the end of the data. The main use case of the Base58Check is to prevent sending Bitcoin to an invalid addresses. The Bitcoin wallet when presented with the Base58Check string, it will calculate the checksum of the data and compare to the checksum included in the code. If they match, it’s a valid address, if don’t the address is not valid.

So guys, I hope that you learned something new about Bitcoin, if you have any question or suggestion just leave a comment, I’d be happy to answer

Coin Marketplace

STEEM 0.27
TRX 0.13
JST 0.032
BTC 63096.57
ETH 2954.05
USDT 1.00
SBD 3.55