What is cryptocurrency?
Cryptocurrency! What even is it? Is it just a sham or a new pathway for great investments? How did it even come into existence? Who is behind its invention? What are the mechanisms that make it work?
Despite being a contemporary internet sensation, the basic knowledge and the whereabouts of cryptocurrency still remains largely a mystery in the eye of the public. Anyone seeking to find out more about this shall be finding the following section very useful.
(Disclaimer: In order to understand and be able to make successful investments in cryptocurrency, one does not need to be a tech-head or a coding master. Surface level information shall be good enough, which this article shall explain eloquently).
In order to understand cryptocurrency from the grass root level, let us imagine a balance sheet maintained by a few roommates, who keep a track record of the transactions they make in order to pay for rent and utilities. The sheet includes the details of who owns whom how much. Now this balance sheet is to be kept public and the following protocols are to be followed:
- Anyone can add lines to this balance sheet, pertaining to the relevant transactions.
- All parties settle their debts up after every three months.
- All this shall be done online, without the interference of any external party.
This would give way to the invention of cryptocurrency:
Balance sheet — Trust + Cryptography = Cryptocurrency
Now the first problem with such a balance sheet is that anyone can add a line here. So what is to prevent the first friend from writing that the second friend owes them, let’s say, 350$, without the second friend’s approval?
To cater this problem, a phenomenon called “Digital signatures” comes to play.
So what is a Digital Signature?
The idea is that the second friend should be able to provide approval for the addition of this line and that their approval should not be forgeable by anyone. So, at the beginning of this system, all the parties involved get a “public key-private key”, each of which looks like a string of bits. The secret key (a synonym of the private key) is to be, as its name suggests, kept a secret.
With the combination of both of the keys, the second friend can add their “signature” in front of that line, in order to display their approval. The “signature” itself is another string of bits. This digital signature is linked (rather locked) with what the message that the signature’s corresponding line reads. So, altering the message, even slightly, could completely change what your digital signature on that message should look like. To summarize:
Sign(Message, secret key) = Signature
All this means that:
- Only you can produce your signature: due to presence and usage of the private key.
- Nobody could just simply reproduce your signature on any other message as the signature varies from message to message.
In order to verify a sign, a mechanism of True/False exists, whereby the signature is checked is cross referenced with the corresponding party’s secret key. This is done so that there remains not even the slightest of chance for someone to forge another’s signature.
The matters regarding the verification and forging are not the only problems in this system which would require plans to be dealt with. What about the problem of, let’s say, a third friend, who is a party in the balance sheet, simply chooses to go in absentia in order to avoid paying the hefty sums that he owes to the other parties involved in the transactions.
The first way this problem is tackled is that the no one should be allowed to make more transactions than the amount of money they already have on the balance sheet. For example, if a third friend has a 1000Rs on the balance sheet, this person could not pay and/or owe any person more than 1000Rs. Any message that breaches this limit would be considered invalid as well as the signature next to this message.
.
To put emphasis on this concept, let us start referring to the quantities on the balance sheet as “balance sheet currency” or “BSC”. The idea of BSC is basically the basis for the idea of cryptocurrency. The main gist of cryptocurrency would be that the parties involved in the balance sheet transactions could trade real currencies with an equivalent amount of BSC: a virtual currency whose amount would also depend on the history of transactions on a balance sheet.
Balance Sheet Currency = transaction history
So who owns the balance sheet? Who controls all the transactions being done on this balance sheet? If there is no central authority controlling these procedures, how could it be made sure that everyone honors the transactions and settle their debts?
In order to mitigate this trust issue, everybody (involved) would keep their own copy of the balance sheet. Once a transaction is made (a line is added to the balance sheet), it would be broadcasted, and the knowledge of this transaction would be made public for everyone (involved) to keep this record in their personal balance sheet.
In order to ensure the uniformity of all private balance sheets, a tool named “crypto hash function” comes to play.
What’s a hash function:
It is important to know the amount of computational work is regarded as the basis for the validation of a balance sheet. So, the idea governing the hash function is that since a fraudulent transaction in a balance sheet should be made so laborious to execute, that anyone trying to do so would eventually give up and abandon the idea.
A hash function takes in any kind of message or file, and outputs a string of a fixed number of bits (e.g. 256 bits). This output, named “the hash” or the “output of the message”, is supposed to look random. This is far from true since the output greatly relies on what kind of input shall be provided. Altering the input, however, even slightly, completely alters the output and this change in the output is, by all means, unpredictable. This unpredictability in the output renders it impossible to make us of reverse engineering by making use of the output in order to get what the input was.
So how could hash function make the entire thing un-forgeable? How can hash function prove that the balance sheet with the maximum amount of computational work?
Lets us, supposedly, take a balance sheet that has undergone a huge number of transactions. Now at the end of the list of transactions, if a special appropriate number is taken and SHA256 (a hash function) is applied to it, the first 30 bits of the output are all zeros.
The number that is to be put into the hash function to get the desirable output is not any random number. This number comes as a courtesy of the efforts done by a “miner”, whose job is to find this number through a long process(). This number is called “proof of works”, and this number is used to verify a balance sheet. Changing any transaction in the balance sheet would mean that all the mining process has to be done yet again in order to find the proof of work.
A block (a personal copy of the balance sheet belonging to any relevant party involved in the transactions) is only valid when it has a fixed proof of work. Also, to ensure that there is a standard order of these blocks (blocks of balance sheets); a block shall be made to contain the hash of the previous block. This way, if any change in any block is made or if the effort to swap the order of blocks is made, it would change the block’s hash, which would further change the next block, resulting in the change of all the subsequent blocks. Now, since all the blocks have been changed, a new proof of work would be required, this would, again, require doing all the mining work.
Since all the aforementioned blocks are chained so tightly, they are called “block chains” (instead of balance sheets).
In this system, anyone in the world can be a “block miner”. Their job description would tell them to find the “proof of work” and broadcast this to throughout the network of blockchain. On finding the proof of work, the “block miner” shall be rewarded with some amount of the ledger currency, which would be created out of thin air. This is called the “block reward”.
(This is actually an exception to usual rules about whether or not to accept transactions. Since this particular transaction does not come from anyone, it does not need to be signed. It also means that the total number of ledger currencies in our economy increase with each new block).
As for the non-mining users, instead of listening for the transactions, they’ll start listening to the blocks being broadcasted by the miners and keep on updating their blocks.
However, if users find two distinct blockchains with conflicting transaction histories, they would defer to the longest one (the one with more computational work). If two contradicting blockchains have an equal amount of computational work, the user would have to just wait until an addition makes one of the blockchains longer. So, despite the absence of a central regulating body, everyone has a way of arriving at a decentralized consensus.
In order to better understand the level of security in all these works, one should also know the hacks some fraudulent party may subscribe too in order to get around the security system.
Imagine a user trying to send another user 200 units of balance sheet currency, without broadcasting this transaction to the rest of the network. This way, all involved parties would think that the first user still has those 200 units of Balance sheet currency. To this, the first user would have to find a valid proof of work before any other does.
Even if the first user successfully does so, the second user would still be listening to the broadcasts made by the other miners, so to legitimize this fraudulent transaction, the first user would have to do all the work to keep adding the blocks in order to meet the amount of work being put in by the other miners.
Since, as per protocol, the second user is led to believe in the validity of only longest chain they know about, the first user could only keep at par with the rest of the miners for a very little while (only for a few entries). However, to keep on doing this in the long run, the first user would need to have 50% of the computing resources among all miners. So, safe to assume that the probability of this happening is very slim as one user cannot keep on maintaining their fraudulent work and eventually the blockchain by the other miners will become longer, resulting in second user to accept the longer blockchain.
to further enhance the security, the proof of work would keep on changing from let’s say 30 zeros in the beginning to 33 zeros in the beginning, periodically, so that it should take, on average, 10 minutes to find new a block.
So greater amount of miners would mean that the challenge of finding the proof work gets harder and harder in such a way that this miniature lottery only has one minute every ten minutes.
With new advancements being made each day and more sophisticated cryptocurrencies emerging as the clocks tick, blockchain and cryptography is, indeed, the financial future of the planet!
Reference: 3Blue1Brown YouTube channel