Blockchain & CryptoCurrency : How it works

Mr. Smith is a wealthy person. Since his early days, he has special interest on old & rare Arts. He has a small museum in his house where his collections of arts are displayed. But problem is that, both collecting these sort of things & keeping them in own collection is a difficult thing. Because there are many bad people who keeps their eye on such things around themselves & Mr. Smith knows sometimes organised crimes take place for such rare things. He don't wanna get into any trouble in this old age. So, he was thinking, is there any way which can help him preserving all Arts in this collection, such that -

Mr. Smith's problem is actually a very old one. If we wanna talk about this, some concept of Economics or specially the Currency System will come up. Well, I am an Engineer, so I have to try explaining this with kinda layman's knowledge.

Current Financial System

Many many years ago when there was no currency, people used to exchange things according to their need. The biggest problem in that system is that, Say, A farmer called Bob requires a bucket of rice, in exchange he will give a bucket of vegetables from his farm. His neighbour Allen has a bucket of rice to trade but he does not require vegetables right now. So, no exchange can take place between Bob & Allen.

So, as time went by, people thought they need such a thing that has some value to everyone, like Gold. That made Gold a kind of unit that can be used to measure the value of an asset. In the past, people used gold or gold coins directly for any transaction, that eventually turned into bank notes as people needed. This is how, different fiat currencies like USD, EURO, GBP came into existence. A country's government & the federal bank can take the decision of publishing new bank notes into market for our usage. Banks & Banking Systems have come into existence to deal financial transactions, trading of assets and many other things for both individuals & organisations.

So, from the context of this article, let me explain the role of bank with an example.

Say, Bob needs to send some money to Allen for some particular purpose. But the problem is that, Allen's reputation is not good in financial transactions. Bob knows, if he pays Allen in Cash, it might be difficult for him to prove the transaction if such situation comes. Allen might deny about taking the money. So, what's the solution ? We need a trustworthy third party organisation whose job is to legitimate a transaction. It means, money from Bob's account will go to Allen's account through this organisation and it will keep the legit record of the transaction between Bob & Allen, so that nobody can question about it. You got it, This third party organisation is called Bank.

Now, what if Bob could send the money to Allen directly without going to any bank or third party? Here we are thinking of such an automated system that can handle transaction of money or any physical thing that has value in a secure & transparent way where hacking, stealing/change of information, fraud is almost impossible.

This amazing technology is called Blockchain. Many top technology personnels & companies are seeing this technology as the future of banking & solution for many other existing problems. Many big corporations, banks are investing billions for the research & development of this tech. Blockchain system & first cryptocurrency for this was developed by Satoshi Nakamoto. His identity is unknown, It is assumed that It is an alias of a group of brilliant people, I don't wanna use the term hacker.

What is Blockchain ?

Let's consider a system where different transactions of finance or assets are going on all the time. Take all the encrypted data of the transactions that has taken place within a certain time interval & take a couple of other things(we'll see later) to construct a valid block. Blockchain is a unchangeable, distributed & decentralized ledger of these blocks sorted in chronological order.

Well, it's actually a bit hard to understand in a single sentence, so let's see it through. In my writing, the blockchain I am talking about is the Bitcoin Blockchain. There are also other blockchains doing different sort of things. But what's a Bitcoin? Just hang on, We'll know few minutes later.



Like our fiat currency, Cryptocurrency is also a currency & a medium of exchange. That means, what we do with normal currencies like USD, GBP etc, we can also do that with cryptocurrency. The transactions that take place in blockchain network are done through cryptocurrency. There are many cryptocurrencies available, such as Bitcoin, Bitcash, Monero, Litecoin etc. Like our fiat currencies, exchange value of cryptocurrencies also fluctuates in the market. Here we'll only talk about Bitcoin, It's the most familiar one among the cryptocurrencies.

We must remember one thing, This currencies & it's technology has been designed in such way that, the currency system & related things can't be within the fist of any person or organisation. Such that, nobody can manipulate this for his own interest. The whole process has been developed in such amazing way so that nobody can take extra advantage from this system. Let's see how.

How Bitcoin is created

We know that all the existing fiat currencies are controlled by the Government & The Federal Bank of a country. The Federal bank can take the decision of creating new Banknotes considering the economy of the country and some other factors. So, these controllers actually have the authority to manipulate this thing for their own interest, isn't it? For example, Zimbabwean Govt. tried to solve their every problem by publishing tons of new banknotes for many years, which caused them very high inflation rate. In plain English, which means, value of currency is so low that if you go to buy a bottle of water you'll need lots of cash. Anyway, it's an arguable topic in terms of Economics, We won't go into that.

But Cryptocurrency is created in a totally different way. New bitcoin is created or mined in approximately 10 minutes by a fair competition solving a Cryptographic puzzle. Let's dig deeper on this, We'll just need to keep our head a bit cool :) Let's go.

Those who know about encryption, should be familiar with SHA256 encryption. Those who are not familiar, It's just enough for now to know that, If we encrypt any data with SHA256, we'll get a cryptographic Hash for that data. To understand with ease, Hash is simply a text that looks something like this "000001beeca3785d515897041af0a7". If we even make a slight change in the data, We'll instantly get a different Hash. So, if we encrypt data with SHA256 then, the Hash will always be the same for a particular data and it will be the same in every computer.

Now, let's look carefully, The Hash I have used above contains 5 zeros at the beginning. It's intentional. And this is actually that Cryptographic Puzzle I told about earlier. Confused ? Well, don't be.

In every second, lots of transactions are going on in the Bitcoin blockchain. After a block is added to the Blockchain, for around next 10 minutes all the transactions keep gathering in Miners' computers. What is a 'Miner'? Let's assume, Miners means us & We are ready & waiting to solve a puzzle with our computers. Now, Miners' or our target is that, We have to find a cryptographic Hash with exact similar pattern like the example containing 5 leading zeros. And we have to find this hash by combining all the encrypted transaction data, Hash of the previous block & A Random number called Nonce (Nonce = Number Used Once). But why 5 leading zeros ? It is called the difficulty level which indicates how hard is it for the Miners to solve this puzzle.

Thus, from this moment, thousands of Miners all over the world will run into a competition to find that Hash. But problem is, It can't be won with any algorithm or other smart way. It is kinda Brute Force of trying Nonce one after another and check if a Hash is found that matches the pattern.

The Miner who finds the Hash before everyone else becomes the Champion of the competition. Finding a Hash means, being successful of making a new valid block for the blockchain. Awesome, isn't it? As a reward of becoming a champion, the winning Miner gets 12.5 Bitcoins. How about the others? The rest miners will also get the Hash very soon. Their job is to verify the result of the Winner Miner. In this way, when approximately 51.7% miners verify the Hash, the new block gets added to the blockchain as a valid block. A recently added block is displayed below in the picture:


So, Bitcoin is created this fair competition where everyone has the participation & almost equal advantage from the system. If someone wants to purchase Bitcoins, he can either purchase from Miners or there are websites of Cryptocurrency buy-sell which works almost same like a regular money exchange service.

Security of Blockchain

From Hackers

We told earlier, a major feature of Blockchain is that once a valid block is added to blockchain, it can't be changed. It's nearly impossible to change the block because any change violates blockchains integrity. That makes it very very difficult to hack. But why is that ?

The reason is an interesting one. A block contains several records of transactions and all these data are encrypted. If you have done a transaction, then you'll only be able to read your transaction data with your own private key. Let's assume, a very capable hacker has been succeeded to make this impossible possible. Say, he has cracked the block number 10000 and changed some transaction records within the block.

Now what happens ? We knew earlier that every block has the Hash of it's previous block. And a block's SHA256 Hash actually consists of transaction data, Hash of previous block & a Nonce. It creates a big problem which is, as soon as a bit of data gets changed in the block, It's SHA256 Hash gets changed immediately. A change in Hash took place means, the block is invalid now because The changed hash won't match the hash pattern. Block number 10001 contains the hash of block 10000, So as soon as block 10000 gets invalid, the next 10001 also gets invalid because of this change of Hash. This works like a chain reaction as these blocks are connected one after another. So, within a very short time all the blocks starting from 10000 till the latest one, become invalid.

So, if the hacker wants to hack it properly, then he must correct the Hashes of all blocks from the block he cracked. As we know how it works, so we can say, he must have to mine every block again & every block needs to be verified by almost 52% miners. And the mighty hacker has nearly 10 minutes to complete all the minings. As we know, mining a new block, verify & adding to blockchain this process takes approximately 10 minutes, so It is nearly impossible to mine so many blocks within this short time even with the very best hardwares.

Security of data

Transaction data is safe in the blockchain. Current banking softwares that banks use may keep their data in a single server or maybe in a couple of servers. Well, of course these are secured because these data are sensitive and banks uses lots of money on protecting these data. Still, if somehow a hacker can hack a server, then the bank & the customers will be in trouble. If one or a few servers falls in danger, the whole system can be down. But blockchain is different. It is distributed & decentralised. It means, the same data is kept in thousands of computers, data centers etc. If all of them except one get destroyed, it will still work. But it's nearly impossible in reality, to make it possible the internet needs to be shut down. And as the data are strongly encrypted, so we can say it's secured.

However, To discuss about how to solve Mr. Smith's problem, We just knew a new technology called Blockchain & Bitcoin. Now we know how they basically works. Next, We'll know on another article how this technology can help solving Mr. Smith's problems.

bitcoin blockchain bitcoin mining cryptocurrency
Share this article


Ashiq Uz Zoha

Software Engineer, Entrepreneur & Technology Enthusiast

Dhaka, Bangladesh

My recent articles: