The science of bitcoin explained in the simplest way.

Ashif Shereef
codeburst
Published in
13 min readApr 2, 2018

--

By the time you finish this blog, you would have become an expert in the working mechanism of bitcoin and it’s associated miracle- the Blockchain.

Bitcoin demystified in simple terms

Even if sun’s total energy output is taken for 32 years to power a super-computer, it still won’t still be able to crack Bitcoins protocol.

The current value of Bitcoin, at the time this blog was written is 3000$ and that’s more value than gold and diamonds or any kinds of assets. If you have 10 Bitcoins in your possession, you are a millionaire by now.

We will now begin. I insist to stay till the end because we can only begin earnestly and gradually go deeper, because that’s the best way to explain things that has some inherent depth to it. You just don’t dive into the abyss first. You practice in the shallows and then take on the depths when it is time.

Quite recently, Bitcoin has taken the economy by storm when it surpassed the upper limits set forth by certain theoretical digital prophecies. In the west, Bitcoin started a decentralized digital revolution years ago, when an anonymous man (a pseudonym) named Satoshi Nakamoto created an ingenious mathematical wonder known as block chain, a decentralized database technology that empowers the Bitcoin.

So basically, what is Bitcoin?

First, let me break the ice.

Bitcoin doesn’t exist. That’s the real bummer. It’s funny. They don’t exist anywhere. Not on any server computer or not in your hard drive. You can’t point to something and say “This is my Bitcoin”. It is just a fairy dust.

Bitcoins exists as records of transactions between different addresses that are stored in a publicly distributed ledger called the block chain. In case a traditional centralized banking system, the apex bank holds the ledger of all the currencies it has issued. In case of Bitcoin, this digital ledger, is vastly distributed across all the nodes in the network that is participating in mining the Bitcoin. That ledger, is known as the block chain. You perform a transaction, it gets updated to every block chain that exists in the network. Hence, block chain is a technology that is decentralized. Anything that happens in the block chain is a function of the network as a whole.

So your wallet doesn’t actually hold the Bitcoin. Your wallet stores the secure keys that enables you to access your Bitcoin address in the network. Does that make sense?

If not, try to think of it like this. Your wallet stores the key with which you can open your safe. Yes. The safe. That’s where your money is stored.

So how is the Bitcoin sent or received?

To answer that simple question, one must be patient and must place himself/herself in the epicenter of this revolution and start thinking outwards. Not inwards. By the end of this blog, you would know more about this revolution than 90 percent of the people out there who pretend to know.

Let’s begin.

We have come a long way in economics and commerce. From the barter system in the long past to declaring a set of standardized asset as the foundation for commerce, mankind has enabled globalization and open commerce across the borders.

As of the statistics of the contemporary world, 92 percent of the world’s currency is in digital form. That’s around 60 trillion US dollars. It includes deposits, cheques, and assets that can easily liquidated. So basically, all our money, the fuel for our entire brief existence on this little blue planet, the stuff we worked our asses off for, has just shrunken from bloated paper notes to just electric signals sent across a protected network. They are just feeble electronic representations travelling to and fro inside a cyber-superhighway.

And who verifies these transactions?

The trusted third parties (TTP) that we call the banks. Oh, too much power concentered in a few men.

So how and where does this crypto-currency fit into?

We will just go with a real world analogue. Imagine that you want to give your friend Sam a Coin. You both meet one fine forenoon and you hand him over the coin. You know that the coin has left your possession and it is Sam’s forever and he may choose how to spend it. To buy some ice-cream or to pay for movie ticket. The coin has no use for you anymore. It has left you. (Sad though!)

So far so good.

Now, imagine that the coin is digital.

That’s when the problems begin. Being digital, you can duplicate the coin. You can save some copies in your computer itself, give one to Sam, fool him or send some over to your girlfriend. That’s the problem with payments being digital. No one really knows whether they are dealing with the real asset or just a copy. This is an infection of the basic system itself. The paper notes that really are worth shit has value only because we give them value. We hold up a currency, and then says “Aaah, its a hundred dollars. This is so much worth it” and Boom, there is value. (Err, actually it is governed by complex economics, but that’s the basics of it). So what happens if people know that the digital currency in circulation may not be original and can be duplicated easily?

If duplications happens in mass scale, it loses value. The economy collapses. Revolts happen. People starves and kill each other fighting for the limited resources available. Scary. So such a currency, which is ‘double-spendable’ will not stand the test of time.

Any currency system, that has inherent vulnerability in them which enables them to be spent many times over, sabotages the entire economics built upon them. Civilizations collapses with economic collapse.

Smart people has called this issue “Double spending” and Bitcoin is the first digital currency to solve the problem.

Let’s see the genius behind the working of the Bitcoin. I am using the classic Alice and Bob analogue that we are so familiar with. (Or not. depends upon the course you took in college. But don’t worry. Alice and Bob are here to diffuse tension and make things easy for everyone from high-schoolers to undergrads).

Now, you only know that Bitcoin is a digital currency. We will begin from there.

Strictly off-topic; if you love the way I explain technology, you should definitely sign up for my newsletter singularity shots here. I send small shots of wisdom once every week.

Imagine that Alice wants to send Bob a Bitcoin. She needs to have a wallet, which is a special software, where, it seems, she collects the keys required to access and transact Bitcoins in the network.

To send Bitcoins (aka, perform transaction), a person needs two things. A Bitcoin address and a private key. A Bitcoin address is a randomly generated alphanumeric number. The private key is another set of numbers, but unlike Bitcoin address, private key is kept private (as the name aptly suggests). If you have heard the term private key before, you must also know that it is so important to keep it safe. Others who doesn’t have much insights into cryptography, don’t worry. Just think of it like your password. It is so damn important.

Think about your Bitcoin address like a safe deposit box with glass in the front. Everyone can see what’s in it, but only a private key can unlock it and take things out or put things in.

Alice then signs the transaction with her private key (Like signing cheques in the real world) and then send out the transaction to the wider Bitcoin network.

The transaction consists of 3 pieces of data.

  • The input. This is the record of the Bitcoin address of the person she has received that Bitcoin from. In this case, let’s say this is Richard’s address.
  • The value. This is the value of the Bitcoin to be sent.
  • The output. This is the Bitcoin address of the person she wants to send money to. In this case this is bob’s address.

Now, the mathematical magic of the block chain happens. Let’s dilute the logic into two versions. First, let’s put it in layman’s terms, and once the general idea has been conveyed, let’s delve into the less simple explanation.

Let’s start with the simpler explanation first.

People are doing Bitcoin transactions all across the world. They are sending and receiving Bitcoins as financial payments.

But somebody has to make sure that these transactions are valid. For validating, these people, called as the miners, have to solve a computational puzzle. The person who solve the puzzle gets to validate the transaction and add the transaction to the rear of the block chain. Once the transaction is added to the block chain, two things happen.

  • He gets rewarded with 25 Bitcoins. (aka 25 Bitcoins are released into the network and he has the key to access them and transact them)
  • The validated transaction gets updated to every miner’s node.

That’s the simple version of the convoluted plot.

I know your thirst isn’t quenched. You inquisitive geniuses, you want more.

Let’s peel back the layers and dive into the depths by approaching the process in a more comprehensive and mathematical manner.

Alice has sent bob a Bitcoin. This transaction is reflected into the network, from where a miner collects the block. A miner is a person in the Bitcoin network who is hunting for Bitcoins. Now he has to perform a processing and find a mathematical solution that will ultimately validate the transaction. Until he validates it, the transaction remains pending, and people all across the world are mining, because they want to get super rich and buy private islands.

What is mathematical solution, you may ask?

It is a cryptographic hash function the miner needs to run in his computer. A hash is a one-way function that maps a data of arbitrary size to a stream of bits of fixed size. These hashes have interesting properties. Given a set of data, it is very easy to generate its hash. You can create a text file in your desktop and then generate its hash in seconds. But in case you change the content of the text file even by a comma or a full stop, the resulting hash changes significantly. You now know where you have seen it mostly- in the torrent sites from where you download the movies. There is a hash being printed there, that lets you verify that the torrent you have just downloaded is the one which was original uploaded, and not an intruder virus file.

For example, the following is a hash of a text file with my name typed inside it.

3396CC34D85109666D443CC4699DAF83

If I put an extra full stop after my name inside the file, and then recalculate the hash, I obtain

B7A181EFE22F0E6C71C20C6C62FB2FF8

Did you notice the strange shifts in number? Those two numbers have no correlation at all. There is no way in hell that you can reconstruct my file from that hash. I will explain why.

One specific property of hash is that it is almost impossible to recreate the data from the hash, hence being “one directional“. The only way to reconstruct a data from its hash is to run a “brute force attack” algorithm that tries every possible combination of data to “rehash” it. But if the hash is significantly long and strong enough, a computer will dissipate to nothingness along with the ultimate heat death of the universe before it can reverse the hash. Hash algorithms like SHA256 are protecting your passwords as well as your browser from a variety of attacks.

SHA256 is used everywhere these days, protecting your bank transactions, your ATM PINs, your Facebook accounts, and so much more. It is omnipresent. So you may ask, if it is possible, how much time it would take for a set of supercomputers to reverse a hash?

We will come to the security details later.

So the miner has to run a cryptographic hash function on the data that makes up the block. Mining algorithms that the miners use employs other data too, to create the hash. One of these data is the hash of the previous block in the block chain. They might use some more random data too, sprinkled in there, for like a little seasoning. Just think it like this.

You take the contents of the block (to be validated), some random data of your own, the hash of the previous block, and then mixes all this and generate a hash.

So when the hash of every block is created, the hash of the previous block is also used for generating that particular hash. So each block’s hash is produced from the hash of the block before it, and the link grows back to the very first block created in the block chain, at some time in January 2009, when the Bitcoin was launched. If someone dares to tamper with the blocks and try a fake transaction, the hash associated with the block will change, and when users run hashing on those fake blocks, the system will instantly understand that the block has changed from last time. The transaction will be instantly spotted as fake.

So we have learnt that generating a hash from the given data is a very easy process. (It’s the reverse that is impossible)

So naturally, the question arises. If his only task to earn Bitcoin is to generate a hash, wouldn’t it be so easy to generate Bitcoins?

NO. NO and NO.

Let me ask you why you consider gold to be invaluable and priceless? It doesn’t cure cancer. Nor is it the elixir of immortality. Still why it is placed above in the desired list of almost all the people of the planet?

It’s because of the fact that you my friend, is sadistically in love with the titillating notion that somewhere, young African boys are working their asses off, either as slaves, or being exploited by some greedy gold miners, down there in some pothole below the surface of earth, in the scorching heat, to dig out the gold that you so proudly wear around your necks and fingers.

Gold has value only because it is difficult to mine.

The same economics goes for Bitcoin too. This time, the mining doesn’t exploit anyone.

The Bitcoin protocol needs us to generate a hash that meets certain hard-bitten criteria. These criteria often require huge processing powers to be performed on power-hungry algorithms. The process needs to be resource intensive. The system is designed to be difficult, because if it was any easy, then the Bitcoin would lose its value because all the coins would be mined out in a manner of minutes. But, the ingenious mathematical design of the system makes sure that the hashing function is time-consuming as well as resource intensive.

This concept is called “proof of work“.

The proof of work is a concept that ensures that enough resources has been put into the production of the output. It is another way of saying that “hard work and time” must be put into the system in terms of electricity, computational power and algorithmic complexity. Bitcoin network wants us to generate a hash that meets a particular criteria. For example, the generated hash should be less than a particular number, called the “target value“, which is determined by the network. This concept can be simplified as follows.

The hash the miner has to generate must start with a certain number of zeroes. This is supposed to be an example of the “criteria“. AS it is extremely difficult to generate a hash that starts with many zeroes, many attempts must be made with different random bits (called the “nounces”).

Here, we must define the term,” mining difficulty“. It is a measure of how difficult it for a miner to generate a hash that is less than the target value. This difficulty factor has been coded into the platform since the genesis to prevent simplification of the network. In case many miners brings loads of computational resources into the network to generate hash, the rate at which new blocks are verified will naturally increase. This leads to increased Bitcoin release in a given time. In that case, all the Bitcoins would be claimed within no time. In order to overcome that scenario, the mining difficulty will self-adjust and increase when more computational power and more miners are brought into the platform. When the computational power is removed from the network, the mining difficulty goes down. This helps in regulation of the network. It is a flawless and beautiful mathematical course adjustment mechanism. The ideal average mining time of a mining operation is set as 10 minutes per block. The network increases and decreases its mining difficultyto keep the mining time a constant.

This also ensures that even if all the computers and supercomputers in the world are brought to mine the network, the mining time would remain constant.

Now that’s a genius level intellect we have witnessed there.

Once the user generates the hash that meets the criteria, 25 new Bitcoins are released to him as his reward. This is the only way Bitcoins can be generated in this network. In other words, the only way to generate new Bitcoins are to validate the latest transaction in the network. This makes the network foolproof.

The block reward is the reward the users gets for validating one block. The block reward is cut in half every 210,000 blocks, or roughly every 4 long years. The block reward that started at 50 in 2009 has reached 25 in 2014 and it will continue to decrease. The ever-decreasing block reward will hold the value of Bitcoin straight up always, and by the end, mathematically 21 million bitcoins would have been released, by the year 2140.

It is a mathematical certainty.

Bitcoin is generated inside a network that operates in a peer to peer system run by people known as miners. Just like the internet. Powerful computer systems all across the globe, sending and receiving data atop a set of fixed protocols is called internet. Bitcoin network is the financial version of internet.

Blockchain technology and Bitcoin has given the power to issue and create currency into the palms of common people like us. It’s like printing our own money but is accepted worldwide. Revolution indeed.

Now, being a network entity in a virus-inflicted hack-prone age, how do you trust your financial value with Bitcoin?

The answer is- by having trust and faith in decentralisation; and the network. It is not controlled by anyone. It’s a technological utopia. But Bitcoin is a bit more concerned about security. It’s a story for another time.

— — — — — — — — — — — — — — —

--

--

Engineer | A.I Enthusiast | Entrepreneur | Tree-Hugger | Programmer | Writer | Running a tech start-up