Cryptocurrency and blockchain basics

03 May

Cryptocurrency and blockchain basics

In this article we cover cryptocurrency and blockchain basics.  By the end of this post, you will be able to explain the concepts of blockchain, have a solid understanding of hashing and mining and you will know how to obtain cryptocurrencies.

A cryptocurrency is an electronic currency that is used for transactions between two parties, similar how we use US Dollars and Euros.  Transactions of cryptocurrencies are documented on a blockchain architecture.   The blockchain architecture is the most innovative aspect of cryptocurrencies.

Let’s review cryptocurrency and blockchain basics.

What is a block in a blockchain?

Blockchain - Cryptocurrency and blockchain basics
Blockchain Graphical Presentation * Cryptocurrency and blockchain basics *

A block is a data structure that holds information about  transactions.  It has a timestamp, an identifier (ID) and an identifier to the block that came before it.  As blocks are created, they are linked using the predecessor identification.  This is how blockchains are extended.

In the graphic above, the simplified identifications used are “243”, “456” and “858”.  In blockchain, the identifiers are 256 character long codes.

A block may hold thousands of transactions, instead of just four as depicted above.  The data usage of a blockchain would be huge if names and values were stored as shown.  It would also not be anonymous.

Blockchain solves these two problems by hashing transactions, such that a block only holds a 256 bit code that defines thousands of transactions.  In Bitcoin, this code is called a merkle tree root.

What is hashing in blockchain?

Cryptocurrency and blockchain basics:

Standard digital media like pictures, emails or videos are, in their substance, made of binary digits (0s and 1s). A hash function takes the digital media and translates it to a unique output called a hash value.

Let’s do an example, the text “Hello World!” can be hashed using a commonly used mathematical algorithm called SHA-256.   The SHA-256 hash value is 7F83B1657FF1FC53B92DC18148A1D65DFC2D4B1FA3D677284ADDD200126D9069 (test it here: https://passwordsgenerator.net/sha256-hash-generator/).  Rather than running that short “Hello World!” text through the hash function, you could run an image or transactions through it.  The  transactions would be compressed to a unique 256-bit hash value.  Changing a single value in a transaction (i.e. Dawn pays Aziz $2 instead of $1), would result in a completely different hash value.

Benefits of a hash function:

Compressed: A key benefit of the hash function is that it compresses digital content or media to a 256-bit value.

Consistent: When you test the hash function with the text “Hello World!” you will get the same hash value as I.  If you use lower caps on World, you will get an entirely different hash.

One way function: Due to its complex algorithm, the hash function cannot be used in reverse.  You cannot provide a hash value as an input to determine the original digital media.

How are hash functions used in blockchain?

Merkle root hash

Merkle Root Hash for Blockchain Transactions
Merkle Root Hash for Blockchain Transactions

When two parties in a blockchain conduct a transaction, the transaction (example: Sara pay John $10) is run through a hash function.  This results in a 256-bit hash value.  The same thing is done for all of the following transactions within the block.

Then the two hash values, each representing a transaction, are hashed again resulting in a single hash value.  This is done for all of the transactions within a block until all transactions are reduced to a single hash value, now called a merkle root hash.  The merkle root is stored in the header section of a block.

In short, the Merkle root hash is the hash of all the hashes of all the transactions in the block.

Now, the block contains a timestamp, a hash value to its predecessor, its own hash value and the merkle root hash.   Remember how in the example above, changing the lower cap of “Hello World!” resulted in a completely different hash value? Similarly, if any part of a transaction were to change, then merkle root hash would change as well.

One step further: All blocks within a blockchain are hashed once, resulting in a hash value that summarizes all historical transactions that have been made to the current point. In Bitcion, every node within the network (every computer in the network) has a copy of this state. All parties within the blockchain agree on this hash value, thereby they all agree on the accuracy of historical transactions.

Note, cryptocurrencies have variations in their hashing methodology.  For example, Ethereum blocks contain the merkle root hash AND the most recent state.  Another difference between Bitcoin and Ethereum is that Ethereum uses the “Patricia Tree” algorithm to calculate the root hash.

What does mining mean?

As new transactions are conducted, they are placed on hold for up to 10 minutes until they become recognized, valid transactions within a blockchain.  Who creates these blocks, if there’s no central authority?

A new block is created when a miner solves a mathematical formula.  Miners are given a target number, for example: 20.  Then two components: the hashed value of new transactions (that are in pending state) and a randomly selected number, called nonce, are pushed through a hash function.  If the result of the hash function is less than the target value (20), the miner “wins” and the new block is ‘solved’.  If not, the miner selects a different nonce until he arrives at the solution.  The correct nonce is broadcast to the network and validated by other nodes to confirm that it, in fact, solves the mathematical problem (hence, often referred to as Proof-of-Work). The transactions within the block are hereby confirmed and the new block is added to the blockchain.

The winning miner receives a reward for solving the mathematical problem.  The reward can be NEW Bitcoins or a transaction fee.   As the total number of Bitcoins is limited, the amount of Bitcoins offered for winning, becomes less and less each year.  Bitcoins are capped at 21 million and by 2140, new bitcoins cannot be won.  At that stage, miners will only receive the transaction fee as a reward.

Mining pools

The mathematical problem becomes more complex as time passes, ensuring that blocks are created within 10 minute intervals. As problems become more complex, more resources are needed to solve them.  This is why miners come together to form “pools” to combine their system resources and solve the problems.

We have now covered cryptocurrency and blockchain basics; let’s discuss the benefits.

Benefits of blockchain cryptocurrencies:

Decentralized – There is no central authority that creates blocks or confirms blocks.  It is entirely managed by the individual nodes within the peer-to-peer network.

Transparency – Due to the linking mechanism, you can trace back to view all transactions that have ever been made. By looking a the current block and following the links to the genesis block you gain full transparency of historical transactions.

Immutable – Let’s say we have 10 blocks in our blockchain and block 7 contains a transaction where you paid Sara 100 coins.  You could try to modify the historical transaction to indicate that you paid Sara only 10 coins, instead of 100. This change would impact the hash value (the merkle root) of that block.  Now you have to find a new nonce to solve the mathematical problem for block 7 to add it back to the blockchain.  If successfully modified, blocks 8- 10, have to be updated as well to reflect the new state 7.  In consequence, you have to solve blocks 8 – 10.  This needs to be done within a 10 minute timeframe, before block 11 is solved. Likely, your computer does not have the resources for that kind of modification.

Fast – you can send money to anyone within the network, anywhere in the world, within 10 minutes.  The transaction does not have to be placed on hold by a centralized bank.

What cryptocurrencies exist?

While most have only heard of Bitcoin as a cryptocurrency, there are in fact over 1,500 in the market right now.  The most popular ones are: Bitcoin, Ethereum, Litecoin, ZCash, Monero, Litecoin, Augur and Ripple.  Ethereum is currently the second largest cryptocurrency in terms of market cap.

Key differences between ethereum and bitcoin:

  1. There are more Ether in circulation than Bitcoins. Three new Ether (the currency in Ethereum) are released every 15 seconds, whereas bitcoins are released much more slowly at 12.5 every 10 minutes.
  2. Bitcoins are capped at 21mm.  Ethereum currently has no limit and over 95mm Ether are in circulation at the moment.
  3. Ethereum offers more functionality (computer code supported operations). These operations are called “smart contracts”.
  4. Ethereum uses KECCAK-256 as its hashing algorithm, rather than SHA-256.  This hashing function is more complex.
  5. Most noteworthy, Ethereum allows other currencies to be developed using the Ether protocol but on different public or private blockchains.

There are many more technical differences between Ethereum and Bitcoin.  You can learn about them here.

How do you obtain cryptocurrencies?

  1. As presented above, you can earn new Bitcoins by solving a mathematical function to add a new block.
  2. You can setup a wallet and request for a friend (or node) to send you coins (in exchange for a cup of coffee).
  3. Or you can invest in a cryptocurrency by purchasing it on an exchange.  There are tons of exchanges available.  We currently like to use CoinBase.  You can earn bitcoin cash by inviting friends to the exchange, which is an added benefit.

This covers cryptocurrency and blockchain basics.  In future posts, we will conduct technical analysis on individual cryptocurrencies and review trends as the market changes.

Summary
Cryptocurrency and blockchain basics
Article Name
Cryptocurrency and blockchain basics
Description
In this article we take a simplified look at cryptocurrencies and blockchains.  By the end of this post, you will be able to explain the basic concepts, have a solid understanding of hashing and mining and you will know how to purchase cryptocurrencies.
Author
Publisher Name
Porsud
Publisher Logo

Write a Reply or Comment