Why Bitcoin is Unhackable

I’ve been interested in Bitcoin and in cryptocurrencies in general since I became aware of them around 2013. A friend and I set up a bunch of computers around that time to mine bitcoins but unfortunately, the difficulty rate was too complicated already by that time and mining with CPUs was pretty much useless. Once we got familiar with bitcoin we thought of investing in an ASIC machine, but after we found out how expensive they were, we got cold feet.

I kick myself every time I think about not buying that ASIC machine though. as usual, bitcoin prices fluctuated a lot in 2013, and I remember my friend and I making a conservative ROI projection based on $50 per bitcoin. The ASIC machine we wanted was around $25k, so we figured that at the best outcome we would have broken even by the time the machine became obsolete.

We never anticipated bitcoin reaching the prices it has reached in recent years. I jokingly remind my friend, we would be filthy rich now.

Anyways, let me put all regrets aside, and dive-in into the topic of why you are probably here.

So, how secure is bitcoin?

bitcoin unhackable

I talk about bitcoin with a lot of people, and one of the questions that often come up is, can bitcoin get hacked? and the answer that normally follows is, oh no, Bitcoin is unhackable. but there isn’t much explanation of why bitcoin is so secure, and people just trust my opinion at face value.

In this post, I will go through some details of why bitcoin is secure. I will try not to get too technical or involve too much math ( I’m horrible at math ) so this post is written in a way to teach my 12 years old son how bitcoin works.

At the heart of bitcoin security is cryptography, that’s why Bitcoin is called a cryptocurrency, duh. Cryptography uses “hashes” to encrypt information, and I guess you are already asking yourself, what is a hash?

A typical bitcoin transaction hash looks like this:

906adfd8a8468c6bcfd36f5c18e6ac43576e30c65438a039ebcaab07056bccc1

Bitcoin uses the 256-bit hash function. The above hash is written in hexadecimal, or at the base of 16, that’s why it only has 64 characters, but if it was written in binary, or at the base of 2, it would look like this:

1001000001101010110111111101100010101000010001101000110001101011110011111101001101101111010111000001100011100110101011000100001101010111011011100011000011000110010101000011100010100000001110011110101111001010101010110000011100000101011010111100110011000001

As you can see, it’s just too freaking long to write it in binary that’s why most hashes are written in hex.

The important thing to remember about 256-bit hashes though is that they are 256 characters long, it doesn’t matter if they are written in hex or binary.

So the possibilities of guessing a 256-bit hash are:

2^256

If you have an advanced calculator with you or if you go to Google and punch in that number, you will realize ( I can’t even conceive it ) how astronomical that number is.

just to put it into perspective, let’s find out what are the possibilities of me guessing your 4-pin ATM passcode or the PIN of your gym locker padlock.

An ATM machine has a keypad number of 0-9 so this would be a 10 character hash ( Decimal ) and the possibilities of guessing a 4-pin passcode would be:

10^4 = 10,000

So in order for me to guess your ATM passcode, I would have to try 10 thousand times. I probably won’t be able to do that manually before getting caught by you or the police, but any computer nowadays would be able to guest that PIN code in less than a millisecond.

ATM

A typical computer CPU nowadays will be able to compare 5 million hashes per second.

Impressive right.

So how long would it take for a typical computer to guess a 256-bit hash?

The universe supposedly has been expanding for 14 billion years, so our poor computer wouldn’t have enough time since the beginning of the universe to guess a 256-bit hash. even if you combine all the computer power in the world today you won’t be able to guess a 256-bit hash in the universe time.

So you can sleep comfortably now if you were worried about Bitcoin getting hacked (:P

Now, there are ways to hack the Bitcoin network without using brute force. Like guessing your account password to get to your bitcoin wallet or slowing down transactions in the blockchain so I can double-spend bitcoins, etc.

Bitcoin was set forth in 2009, and so far it hasn’t been hacked. There have been a few instances where wallets have been stolen, and the mainstream media reported it as bitcoin being vulnerable to hacking, but that wasn’t accurate, that was a human error more than a technical vulnerability in the bitcoin network.

And BTW, the 256-bit hashing function is not unique to Bitcoin, web browsers use 256-bit certificates to communicate between two computers as well. For example, when you visit this page, the information is transmitted between my server and your computer using a 256-bit hash. nobody can eavesdrop that information because even if they were able to intersect it, everything will look just like those hashes above, and in order for them to decrypt such information, it will take them the age of the universe to do it, and then some more time.