Cryptocurrencies — The Coin of the Future

Nivan Gujral
Level Up Coding
Published in
8 min readMar 27, 2021

--

Unless you have been living under a rock for the past 2 years, you have probably heard of Bitcoin or Ethereum. If you haven’t 🤯, where have you been?! Let’s do a quick overview of what they are!

Bitcoin and Ethereum are two of the most successful forms of cryptocurrency. You can think of a cryptocurrency as a digital coin that people use to buy and sell various items with other people. Cryptocurrencies are really secure as they are built off the technology called the blockchain which makes them a decentralized system that is not attached to any government.

Now that we know a bit about what cryptocurrencies are, you may be wondering, how do they actually work??

Blockchain Overview

Time to start with the basics! In order to understand how cryptocurrencies function, we need to first understand how the key technology behind them, blockchain, works.

Blockchain is a decentralized system of recording information in a way that makes it difficult or impossible to change, hack, or cheat the system. It is similar to Google Docs, where we can create a document and share it with people. When the document is shared it is distributed instead of copied which creates a decentralized chain that gives everyone access to the document in real-time. All of the changes are available to everyone so no one can change anything without everyone knowing about it.

Blockchain is made of blocks that store information. In the case of cryptocurrencies the blocks store transaction data. Each block also has a nonce and a hash. A hash is a signature for a block that sticks with it so it can be referred to later on. This is similar to a person’s fingerprint because it is a signature for the transaction data. The nonce is the first number a blockchain miner needs to discover before solving any block. In order for a block to be created, a process called mining happens which is where a person finds the nonce that matches the hash. This process is very difficult and takes a lot of computing power to do. Miners are the people who complete the mining process.

If you want to learn more about the Blockchain, check out this article I wrote on explaining blockchain technology in more detail.

Mempools

In cryptocurrencies, the blocks in the blockchain contain the transactions that took place. In order to understand this let us imagine we have two people named Kenny and Ethan who are trading Bitcoin (BTC). In this scenario, Kenny sent 2 BTC to Ethan for a Birthday present. When the transaction is completed, the block will store the transaction so that it can not be changed in the future. However, if you have experience trading cryptocurrencies, you may know that the transaction is not completed right away. What happens?

After a person clicks send or purchase, their uncompleted transaction will be temporarily stored in the Mempool. The Mempool is a database that stores any transaction that still needs to be completed. Now in our previous scenario, the transaction request that Kenny made will be stored in the Mempool. When a transaction is stored in the Mempool, nothing has happened to the cryptocurrency that is being sent or received. Kenny would still have his 2 BTC and Ethan would not have the 2 BTC.

Transaction Fees

The Mempool is available for every node (user, miner, or any device storing a copy of the blockchain) on the blockchain to see. It also displays the transaction’s hash and transaction fee that will be earned through mining the block. Since the miners are completing the transaction, they look through the Mempool to pick transactions that they want to complete. Miners often choose blocks that give them the most amount of money in fees. Naturally, higher feed transactions will be completed faster than lower feed transactions. Using this to their advantage cryptocurrencies like Ethereum gives users the ability to add a “gas price” or additional money they want to pay to have their transaction completed sooner.

In order to understand how miners choose the transactions that will be completed, let’s follow our example. Let’s suppose in Mempool there are four different transactions the miner can choose from. Let’s also imagine that these are the different transaction,

If you were a miner, which block would you choose to mine? You would probably choose to mine transaction number two because it would give you this biggest personal reward. Since a block can store multiple transactions, the miner would follow a similar strategy and select the top transactions that they can fit into the block.

Transactions and UTXO’s

In normal banking systems, we have a certain amount of money that is saved in the account. Whenever we need to spend the money, we just deduct the money from the account and when we have extra we can add it to the account. However, in cryptocurrencies, the process of removing and adding the currency is a bit complicated.

In cryptocurrencies, there is a certain amount of coin available for people to purchase and sell. Whenever you have an amount of coin in your account, it is just displayed that it is currently in your possession. Previously, the coin was in someone else’s possession before you and someone else before them. This might sound pretty complicated but let’s take an example. Currently, Kenny owns 2 BTC in his account. He got these 2 BTC from John on his birthday. John received the 2 BTC, that he gave Kenny, from Carla who bought the bike from John in exchange for 2 BTC. This cryptocurrency that Kenny possesses originally belonged to Carla who gave it to John and then who passed it on to Kenny. This example shows that the coin is always moving somewhere and when it is in your account, it is just in your possession for now.

Every time a person receives any amount of cryptocurrency, it will show up as an ongoing transaction on their account. The ongoing transactions on a person’s account are called UTXOs or unspent transaction output. UTXOs are any cryptocurrency that is not spent on a person’s account and are in their possession. In our example above, Kenny’s 2 BTC would be considered as a UTXO while Carla and John’s previously owned BTC would not be considered as a UTXO. A person can have multiple UTXOs on their account. In order for us to understand this concept better, let’s use an example. Let’s imagine we are following the account of Kenny. Originally, John sent him 2 BTC for a birthday present. He also received 10 BTC from his grandma on Christmas and 3 BTC from his friend. Therefore in Kenny’s account, he possesses three different UTXO’s which are “John sent Kenny 2 BTC”, “Grandma sent Kenny 10 BTC”, and “Friend sent 3 BTC”.

If the cryptocurrencies are shown as UTXOs, then how does spending work in the background? Let’s suppose that Kenny is going to buy a bike with his Bitcoin that costs a total of 11 BTC (this is a very premium bike). In order to spend the Bitcoin, we need to redirect the possession of the coin to the bike shop. Let’s first take the largest UTXO Kenny has which is “Grandma sent Kenny 10 BTC”. Now we want to change its ownership to the bike owner instead of Kenny. Therefore the transaction, “Kenny sent the bike shop 10 BTC”, would be put in the mempool to be completed. However, the bike costs 11 BTC and we only gave the bike shop 10 BTC. In this case, the system would take the next UTXO we have which is “John sent Kenny 2 BTC”. Now let’s change the ownership of this coin to the bike shop. Wait, how do we that? We do not want to send the bike shop an extra BTC value. Instead of sending the bike shop the 2 BTC, the system would first split the UTXO into two different transactions to give. In the first transaction, “Kenny sent the bike shop 1 BTC”. Yay! Now we have sent the 11 BTC the bike shop requested! But where does the other BTC we did not use go? The unused BTC in the original UTXO will be remade as its own new UXTO in Kenny’s account. This transaction will be labeled as “Kenny sent Kenny 1 BTC”.

Using these techniques, the cryptocurrency system can add and subtract currency from a person’s account.

Wallets

When people sell and buy cryptocurrencies, they generally don’t use the cryptocurrency software directly. Instead, most people use wallets such as MetaMask, Coinbase, etc. These wallets make it easy for normal people who just want to buy and sell their coins. The wallets access your cryptocurrency account through your signatures and keys. Signatures and keys are additional measures to keep your cryptocurrency safe and protect your identity when you are sending and receiving cryptocurrency. The wallets display the amount of total cryptocurrency you have in your account. Wait, but if we learned from the last section, the cryptocurrency is broken down into different UTXOs. Wallets use your UTXOs and add them together to display to the user very simply the amount of currency you have.

The Future of Money

Cryptocurrencies are growing each and every day with millions of new users joining the platforms each month. It is slowly becoming a really good choice as a medium of exchange due to the immense security that it provides to every user.

Currently, there are some major flaws that need to be addressed before cryptocurrencies can truly replace modern currencies as a medium of exchange. Cryptocurrencies have high volatility so it is not as reliable for everyday people. Cryptocurrencies also have been debated a lot as it can be used negatively due to their unregulated behavior. This makes it hard for people to trust it. Cryptocurrencies might also face problems scaling as more people use it needing the technology to ensure the speed and security can be maintained.

Let us review what we just learned:

Cryptocurrencies use blockchain technology to be a form of medium of exchange that people can use to buy and sell items. They use special properties including UTXOs and Mempools to function efficiently. They are finally displayed simply through different wallets for everyday people to understand what is happening.

Cryptocurrencies are becoming a key tool for transacting with people across the world and this growth is expanding every day.

Nivan is a 14-year-old Artificial Intelligence developer looking to use technology to help solve problems in the world. He is currently building a company called Lemonaid which is a platform that connects teens with organizations that are in need of help with volunteer/intern recruitment. Send me an email at nivangujral@gmail.com if you would like to further discuss this article or just talk.

--

--