“It is more likely that the Earth is destroyed in the next 5 seconds, than that a collision occurs in the next millennium.” — @Luke-Jr from Bitcoin Wiki

Bitcoin is a decentralized digital currency that enables instant payments to anyone, anywhere in the world. Bitcoin uses peer-to-peer technology to operate with no central authority: transaction management and money issuance are carried out collectively by the network. The original Bitcoin software by Satoshi Nakamoto was released under the MIT license. Most client software, derived or “from scratch”, also use open source licensing. Bitcoin is the first successful implementation of a distributed crypto-currency, described in part in 1998 by Wei Dai on the cypherpunks mailing list. Building upon the notion that money is an object, or any sort of record, accepted as payment for goods and services and repayment of debts in a given country or socio-economic context, Bitcoin is designed around the idea of using cryptography to control the creation and transfer of money, rather than relying on central authorities. Bitcoins have all the desirable properties of a money-like good. They are portable, durable, divisible, recognizable, fungible, scarce and difficult to counterfeit. Find out more here

Can someone have the same private key as mine? Will he/she be able to use my funds? But, what are the probabilities that such things even happen? Wait… How a Bitcoin’s address is actually generated?

My friend, if you’ve ever asked yourself these questions without finding any answers, well stay calm and relax because the time you’ll understand everything about Bitcoin’s addresses has finally come.

Through this article, you’ll understand the What, the How and the Why of the Bitcoin address.

Ladies and gentlemen, please take your seat and fasten your seatbelt. Our crew is delighted to have you on board and wish you a pleasant journey.

What are Cryptographic Addresses?

Cryptography is a science that gathers techniques and protocols meant for secure communication in a hostile environment. The purpose of such methods is to make entirely sure the content of a message is incomprehensible to adversaries while being readable for authorized parties.

Encryption makes it possible. It is the process that results in encoding the content of a document using an encryption algorithm — a cipher — that generates a ciphertext, a text containing the protected information that can only be read once decrypted with the right decryption key.

One of the most straightforward examples of encryption techniques is the Ceaser’s cipher (also know as Ceasar’s code).

The principle is to encrypt a text message, referred as plain text, by using a fixed encryption key.

This cipher is classified as a substitution cipher as each letter of the original text is replaced by another one, the encryption key being the number of positions down the alphabet.

As an example, let’s take a look at the following text :

“Erh alex efsyx Fmxgsmr ehhviww xlir?”

Well, one thing is sure: that’s not English.

But now let’s assume this message contains information that we know has been encrypted with Ceasar Cipher with a key equals to 4.

We can now decrypt the message using four as our decryption key.

We obtain the following message:

“And what about Bitcoin address then?”

Well, as you undoubtedly already know, Bitcoin is a cryptocurrency that relies on cryptography.

The specific encryption schemes that it uses is the so-called Public-Key Encryption, a notion that first appeared in a 1976 paper written by Whitfield Diffie and Martin Hellman.

The first publicly available public key encryption called Pretty Good Privacy (aka PGP) was written in 1991 by Phil Zimmermann.

It allows for the sender to transfer information to an intended recipient with being sure that only the desired party will be able to open the message.

The pair public key/private key is linked in a way that it’s super easy to find out the public key with the private key, but doing the opposite is impossible. The public key, meant to be shareable, is derived from the private key using an elliptic function.

You’ll find below a drawing I made showing how an elliptic curve looks like.

The design makes certain that, by having two points of the curve (private key), it is effortless to find the third one (public key).

However, the reverse action will give you an infinite amount of solutions.

How is a Bitcoin Address created?

First off, it all begins with the private key.

Bitcoin’s private key is a random 256-bits number. It means that the product is composed of an entirely hazardous mix of 0 and 1.

0010 1000 1000 1111 0011 1001 1011 1011 1111 1101 0011 0110 1101 1010 0101 1010 0001 0010 1101 0001 0110 0010 1100 1011 0001 1000 1001 0111 1100 1001 0000 0010 0010 1000 1000 1011 0011 1001 1011 1011 0011 0110 1101 1010 0101 1010 0001 0010 1101 0001 0110 0010 1100 1011 0001 1000 1001 0111 1100 1001 0000 0010 0011 1101

Generating your Bitcoin private key at home is possible, although I do not recommend it as must be done correctly.

You could theoretically create your own set of private key/public address, print it on a paper and continue receiving bitcoins to the address. You’d then need internet to access your funds.

I could show you how it makes theoretically Bitcoin universal and unstoppable, but that’s for another post, stay tuned!

Here’s a video of a quite crazy guy that flipped a coin 256 times to write an entirely random number to generate a new Bitcoin private key.

“Could it be more randomness than that?”

Once the random binary (base 2) number of 32 bytes (1 byte = 8 bits) is generated, it needs to be converted to the proper format of a Bitcoin private key.

It is common to switch the format to a hexadecimal format (base 16) before next step, so it becomes more human-friendly and easy to read.

288F 39BB FD36 DA5A 12D1 62CB 1897 C902 288B 39BB 36DA 5A12 D162 CB18 97C9 023D

Then, the randomly created number must go through a Base58Check encryption process.

The Base58Check encoding returns a number in base 58 composed of numbers and letters. Different from base 64 number, that contains 26 letters-alphabet times two (upper and lower cases), numbers from 0 to 9 plus ‘+’ and ‘/’, base 58 number are exempted from ‘0’,‘O’,‘l’,‘I’,‘+’ and ‘/’ characters.

By doing so, the software prevents bad-intentioned people from trying to create visually identical looking account numbers, as ‘0’,‘O’,‘l’,‘I’ characters may look the same in some fonts.

After all this, it’s finally done generating a new Bitcoin private key in the wallet import format.

5J89cr5WGdvQWeeekN5ZGzuXVsWREbAYku6MDeUgrJTjX1ZHhCX

And what about Bitcoin Public Address then?

Before getting the public address, we first need the public key. A public key is a 160 bits binary number derived from the private key using an elliptical function, as described previously.

The public key then goes through the hashing algorithm SHA-256 and again through the hashing algorithm RIPEMD-160.

A hashing algorithm is a function that will always return the same output for a given input. However, it is nearly impossible to find the input by only having the output. It is often used as a digital signature, and the values obtained by such function are called hashes.

By doing so, a 160-bit Public Key Hash is obtained, and finally a Base58Check Encryption encodes it to a shorter and more readable form.

Finally, a Bitcoin address has been generated, which you can use and share to receive bitcoins.

1Cwd7i5R6GM56njNhyyr7RRUYo6e1AMg9A

Bitcoins that you can now spend by using associated the private key. Enjoy!

I can see your face going blank reading all these operations. But don’t you worry, if you prefer not going through all this pain to create a new random Bitcoin address, you can also go to Bitaddress.org and generate propero ne ;)

What if someone generates the same Bitcoin Private Key as mine?

If someone generates the same private key as you, you’d lose your funds because the newcomer spend them.

Simple as that.

Now, let’s see why it is likely impossible that a potential attacker randomly generates a private key and get access to your account.

First off, a private key is a 256 bits binary number. It means that there are 2²⁵⁶ possible private keys.

Remember this guy flipping a coin 256 times? Well, if the coin would have landed head instead of tails on a single toss, a wholly new and unique private key would have been generated.

Our friend may have written down this enormous number for the first time in the history of humankind.

Can you imagine sitting in front of the video and tossing a coin at the same time, 256 times, until you finally obtain the same combination as he did? It would take millions of years, maybe billions!

And this how private keys are generated. 2²⁵⁶ possibilities are such a huge number that it’s hardly conceivable for human’s brain. It is to difficult to understand such amount, as an average constitutioned mind like to deal with small digits.

Not convinced yet?

Well, you’re right. There is, in theory, a probability to generate an already existing private key.

But, once again, let’s take a look at the numbers.

Coming back to the common use of base-10 for numbers, there are (watch out it’s big) :

115,792,089,237,316,195,423,570,985,008,687,907,852,837,564,279,074,904,382,605,163,141,518,161,494,337 possible existing private keys.

To quote Greg Walker from learnmeabitcoin.com:

“If I had one million monkeys who could each generate one million private keys per second (I’ve trained them well), it would take roughly 3,671,743,063,080,802,746,815,416,825,491,118,336,277,193,184,902,172 million years (on average) before one of my monkeys generates the same private key as you.”

Such vast numbers are hard to grasp, but this shows well why it is likely impossible that someone generates the same private key as you.

Randomness results in security.

What if two Private Keys give the same Public Key?

Excellent question! You’ve noticed that there are 2²⁵⁶ different combination of private keys, but “only” 2¹⁶⁰ combination of public keys, meaning that, in theory, it is possible for two completely different private keys to give the same address.

This phenomena as a name:

A collision.

If this happens, then both the original owner of the Bitcoin address and the colliding owner would have access to the funds and may spend the money sent to that address.

If you’d try to make a collision intentionally, probabilities are so low that it is always more profitable to work generating a new block and collect transaction fees instead.

By construction, participants are always financially incentivized to work for the security of the network, and not against.

This is the strength of Bitcoin.

All you need to remember about Public and Private Keys

Cryptography and encryption help peers to send and receive information without being threatened by adversaries that could steal sensible data.

Bitcoin found a way to transfer information safely through a decentralized network of untrusted nodes.

Thanks to its design, randomness is your shield if you play by the rules.

Although there is a probability two identical private keys are being generated, the chance remains so ridiculously low that it’s considered impossible.

Learn about Bitcoin and cryptocurrencies, do your due research and stay safe. We still need to learn a lot concerning this emerging technology with great future.

It is by helping each other, sharing knowledge and keep building on new solutions that the world will embrace the Blockchain Revolution.

—

About the author

Robin Lacombe is creating content for Space Elephant, a French Startup which mission is to improve your Blockchain Experience as an user.

If you’re interested by the project, let us know your support and encourage our team by giving some claps to this article on Medium and sharing it on social medias platforms. @spacelephant01