“Bitcoin”-The word is pretty common but very few people understand what actually it is. Do you remember the last time you were worried of losing money because of a failed transaction?(bad luck ☹). Everybody has faced such an issue and we start to curse ourselves as if it was our fault. Actually it was. But why? Because we depend on middlemen, credit cards which are insecure, bank transfers which are slow and expensive. Think of a situation without a third party?. The transaction would turn out to be more secure.

Bitcoin is a digital currency created to serve this purpose. It can be sent from user to user on the peer-to-peer bitcoin network without the need for intermediaries (Yay). Is this starting to make more sense? I can’t hear you from here, so I’ll have to hope that it is. Bitcoin pioneers wanted to put the seller in charge, eliminate the middleman, cancel interest fees, and make transactions transparent, to hack corruption and cut fees. Paying in bitcoin is same as personally handing somebody cash.

But wait, how was this accomplished? Through an extremely clever use of mathematics and software. But who manages the transactions if there is no bank? Before we dive into that, let’s understand Hashing. Hashing is used to manage the transactions.

## HASHING

In simple terms, hashing is a technique that is used to uniquely identify a specific object from a group of similar objects. It is useful when you have a large number of words and you want to search for any word from the collection. Hashing is the process of converting a given key(input) into another value. A hash function is used to generate the new value according to a mathematical algorithm. The result of a hash function is known as a hash key. The original values are then stored in a data structure called hash table using the hash key as index.

Hashing is implemented in 2 steps-
1.First, the element is converted into an integer (hash key) by using hash function.
2.This hash key is used as an index for the original element in the hash table. The original element can be retrieved by using the hashed key.

Let’s suppose, we have a list of integers {11,12,13,14,15}. We choose our hash function as h(x)=x%10. Then in hash table,11 will be stored in  1st(11%10) index,12 in  2nd (12 %10) and so on… If we want to search 13, we can use hash function to find its index and check if it is present or not.In this case,it is present in 3rd  index.

Keep in mind that two elements can generate the same hash. This phenomenon is known as a collision. There are several ways to handle collisions, but that’s a topic for another time.

## BITCOIN MINING

Now coming back to Bitcoin, it does not have a decentralized system. With a trusted central authority, transferring money is easy. Just tell the bank you want to remove Rs 500 from your account and add it to someone else’s account. But how do you create a system that has a decentralized ledger (file for maintaining transactions)? This is done by bitcoin mining. The process of mathematically verifying that new transactions are legitimate takes a large amount of computer power and energy.  So, when computers undertake this process, they are rewarded with a small amount of new bitcoin. These computers and their operators are called “miners” and this process is called mining. Sounds simple, right?

Now imagine, you are a bitcoin miner. Before verifying the transactions, you have to guess a combination lock generated by the system. Of course, this guessing is all done by your computer. The more powerful your computer is, the more guesses you can make in a second, increasing your chances of winning this game. If you manage to guess right, you earn bitcoins and get to write the next page of Bitcoin transactions on the block chain. Bitcoins are created digitally through mining process. Since the Bitcoin network wants to keep the time between blocks created in the block chain constant, as more miners or computing power are added to the network it will become harder to guess the combination.

A hash is used to guess the combination for the lock. It’s used by turning a random large number into a smaller number by taking certain actions. If this doesn’t work you will randomly pick a different large number and guess again. The SHA-256 or “Secure Hash Algorithm-256”, is a common type of hashing used in bitcoin mining. Hashing helps the bitcoin network stay immune to alteration and fraud. This is the building block of entire bitcoin currency.

Now, the question arises is bitcoin secure enough to replace all other currencies? So far, the technology has been trustworthy but the ultimate security of the system is not guaranteed. There is a long road ahead and time would only tell if bitcoin would be a currency of future or not.

### REFERENCES

https://www.geeksforgeeks.org/hashing-data-structure/

https://blockgeeks.com/guides/what-is-bitcoin/