Cryptocurrency for dummies

Ashenkalana
9 min readJun 5, 2021

Bitcoin, Dogecoin, Ethereum, and Ripple. These are just a few of the cryptocurrencies that make headlines in tech websites these days. What is a cryptocurrency? What is the value of bitcoin? Are they safe? How does it work? Who owns these cryptocurrencies? Why do bitcoin miners buy hundreds of new RTX 3000 series GPUs for bitcoin mining? how a nonexistent currency with no coins or bills is responsible for a massive environmental pollution? These are a few questions everyone should know answers if they are interested in investing in the ‘Future of global finance’.

If you are aware of what’s going on in the tech world for the last couple of weeks you must’ve seen How a single tweet from Elon musk skyrocketed the value of a Dogecoin and by canceling Bitcoin as a payment for Tesla cars crashed the value of a Bitcoin. So, it’s needless to say the value of the cryptocurrency market is volatile and unpredictable. Nonetheless, we see many people are still interested in investing in these cryptocurrencies. And the fall down of all these ‘coins’ is nowhere to be seen.

What is a cryptocurrency?

Simply, this is a digital currency. There are no coins or bills. You can’t see it. But you can spend it to buy stuff. And it’s common all over the world. But most importantly, nobody owns this or controls it.

What’s the importance of cryptocurrency?

The answer to this question is can be given in two parts.

  1. Why conventional transactions are bad?
  2. How cryptocurrency is the future.

For the ‘why’ question, the answer is conventional commerce mostly relies on financial institutions as the mediator. In simpler terms, we have to trust a third party to send money to someone. This third party is mostly banks. In addition, with the mediation of a third party, non-reversible transactions are not possible. And there is the cost of mediation, this limits the value, and the number of transactions that can be made and the third party takes a portion of all the transactions made through their institution.

But in early times when the barter system was all we had, people didn’t have to trust a third party to send money. They directly exchanged the goods/services they had among themselves without any mediation. When you are done with the exchange there is no way to reverse it. Like this, in a way, cryptocurrency is an attempt to go back to the old ways. There is no human third party. The whole concept of crypto-based of computer algorithms and cryptography. You can transact directly with each other, no matter how small or big the amount is. There is no room for fraud in the system. You can’t spend the same amount of money twice. The system is secure as long as honest nodes collectively control more CPU power than any cooperating group of attacker nodes (we’ll get to this later).

For the sake of keeping the article simple, I’ll be talking only about how Bitcoin works. This varies slightly from one cryptocurrency to another. But in the end, all these are altered versions of the same basic model.

How does it work?

Imagine you and your 3 friends play a game. And this game involves betting. But instead of exchanging money after every move, you decide to keep a ledger of all the transactions till the end of the game. Each of you records all the transfers individually and, in the end, all of you compare the ledgers of each other and balance them out giving real money to each other. Now remove real money and imagine just those numbers on the ledgers. Still, you can play this game, right? still in the end all of you have some amount of money left. The only difference is this number/money doesn’t have value in real life. What if that number you finally get on the ledger has a real value? Then you can spend it. This is the basic idea behind bitcoin or any kind of currency for that matter.

But to make it an electronic currency, you need a couple of tweaks to this basic model. One of these tweaks is digital signatures.

Let’s go back to that ledger we talked about. There we only talked about 4 people. But for an electronic currency, there are millions of users. So, the ledger should be public, accessible. Like a website. And this should be able to be edited by anyone after a transaction is done. But what if someone adds a record without making an actual transaction? This is where digital signatures come into play.

A digital signature is made of 2 parts,

  1. The public key (PK)
  2. Secret key (SK)
    This is a 256-bit code. (Number anywhere between 0–2256)

Our handwritten signatures are more or less the same in all the documents we sign. But a digital signature changes for each transaction. SK is used to produce the signature. A function depends on SK and the messages containing the previous transaction records produce the signature. PK is used to verify the authenticity of the signature. Another function that varies by the previous transaction records (message), PK, and SK gives out a true-false (T/F) statement.

Here the reason for using 256-bit security is to make guessing the secret key impractical. The following image explains this scenario.

Fig 1: Mechanism of how digital signatures work

Okay, now we made our electronic currency to a secure level that only you can spend your money on. But what if you decide to spend the same coin twice? Or you spend coins more than you own? This is the second question we need to answer.

The easiest way to do this is to make all transactions through a central authority. A place that oversees all the transactions and potential frauds. But the very idea of cryptocurrency originated with the aim of a decentralized currency system. So, the solution to this issue must not have a single entity governing all the transactions.

To achieve this system must know all the transactions done by that user before the current transaction. In this way, it’s possible to confirm a particular user is not spending more than the user’s balance.

This step is important. Because having a history of all the transactions a user has done to this day makes cryptocurrencies independent from other conventional currencies. In cryptocurrency, the history of earning / spending coins is the currency.

Now on to the next issue. As I mentioned before, this ledger should make public. But if one place/website is hosting this ledger that means again the control of the currency is centralized. The easiest way to decentralize this is, giving every bitcoin user a copy of this complete ledger and ask them to update theirs with new information. But there is a better way to do this.

Blockchain technology

Instead of keeping a full record of all the transactions, the ledger is divided into parts and each part is named as a ‘block’. But these blocks should have a connection with each other. So, when we take a particular block, it has 3 main parts

  • Hash number from the previous block
  • Set of transactions
  • A random number (proof of work)
Fig 2: General Structure of a Blockchain

To make this a success, we need a set of people/computers too. These are called miners. The job of a miner is to add new blocks to the chain. There are thousands of miners distributed all around the world. To add a block to the chain, they need to guess a special number. This number is generated by SHA 256 hash function.

SHA 256 hash function

As I mentioned earlier, there are 3 main components of a block. The first two are predetermined. And when all these data are sent through this SHA 256 hash function, it is going to give out a long number that looks random. Usually in hexadecimal. What’s interesting about this number is, nobody can guess it. It’s impossible to reverse engineer it. This is because SHA 256 is a cryptographic hash function.

What’s done in the bitcoin protocol is, it collects a set of transactions and puts it into a block. then, add a special number to the end. So that the special number that comes out of SHA 256 is a number that starts with a bunch of zeros. (eg: 30 zeros; in the bitcoin protocol, this varies periodically). The job of a miner is to keep guessing that special number until they receive the particular hash function that starts with a set of zeros. If someone is lucky enough to find this number, that miner becomes the winner. As a reward miner gets some bitcoins, which currently sit at 6.25 per block. and this reward system is the only way to add new bitcoins to the blockchain/ledger.

Can someone mess with this system?

Let’s say someone decides to spend more than bitcoins he/ she own, he/ she make a transaction and decide not to broadcast it to the network. Instead, he/ she decide to add that transaction to a block and add that block to the blockchain. He/ she might be able to find the special number and add it to the chain. But the rest of the miners will be also adding blocks to the chain. Now the blockchain has two branches (since the fraudulent block is different). Now, the person who committed the fraud has to keep adding links to his / her blockchain to make it believable. But the computing power of the other miners outpowers the fraud blockchain. It grows longer. One of the main principles of this blockchain protocol is, when miners add new blocks, they have to believe the longest chain. So, unless you have more computing power than the rest of the miners combined(>50%), you can’t fool this system.

Fig 3: How a forked chain is made

How do miners make money?

As I said earlier, solving each hash function rewards you. In the beginning, this used to be 50 bitcoins. But every 210000 transactions, this number becomes half. So now it is around 6.25 BTC. If u want to get an idea of how much this is, 1 bitcoin now equals 36000 USD. A few weeks earlier this used to be around 50000USD. In addition to this at every transaction, people who use the currency can decide to give a ‘tip’ to the miner.

Environmental concerns

This is why Tesla company stopped supporting Bitcoins. Back when bitcoin came out, there were no many miners. So, anybody could mine bitcoins even as a background task of their personal computers. But now things are different. Bitcoin mining is done in huge warehouses and with a ton of computing power. Reports state that 1% of the global energy consumption is devoted to bitcoin mining. And energy for this mostly comes from fossil fuel and coal.

As of now, cryptocurrencies are safer, and efficient compared to conventional currencies. Most importantly, you can directly make exchange money with the other party. But the value of a bitcoin changes rapidly. No value is fixed for a long period. So, investing your money in bitcoins can be a risky decision. But it’s believed that once cryptocurrencies become more accepted and the people who use them become more knowledgeable and decide to make decisions by the brain and not by emotions, value of a bitcoin will be stable. And many people believe this will the future of finance.

Reference

--

--