A Very Simple Introduction: What Is a Blockchain and How Does it Work?

A Very Simple Introduction: What Is a Blockchain and How Does it Work?

In the previous article which you can read here, I established how blockchain eliminates the need for intermediaries and paperworks using machine-based trust. But in the absence of intermediaries, how do we perform exchanges online? It's simple. This is the part where decentralized money in the form of cryptocurrency comes in. So it's safe to say cryptocurrency is the cash of the internet.

Suppose we have Mr. X want to send some dollars to Mr. Y who lives in Tulsa, Mr. X would have to put his signature on paper, which is not safe, because signatures are images. And images can be copied and heavily forged, which leaves Mr. X financial assets at a huge risk. But in the decentralized money economy, Mr. X does not have to sign on paper, but will be forced to use a safer system called digital signatures, which are keys that have its root in the Diffie-Hellman Key Exchange.

The Diffie-Hellman Key Exchange was a ground-breaking concept for cryptography, because all that will be required from Mr. X to send some dollars to Mr. Y will be the exchange of special keys between both parties. The exchange key from Mr. X will meet with the exchange key from Mr. Y, and both parties can communicate in encryptions to meet at a key solution without an intermediary. If an intermediary were to be present, that means Mr. X would have to send his exchange key to the intermediary, the intermediary decrypts the key and sends it to Mr. Y, and the whole process continues again and again, which is not good. Because, the intermediary can choose to decrypt the key and not send it to Mr. Y, and that will breach the trust between both parties.

What is a Blockchain?

Blockchain is one block after the other. It starts with the genesis block, which is hardcoded and fixed. With the genesis block first, we move on to the next block of transactions that are summarized into a hash of the block. The hash of the previous block gets attached to the next block, and so on and so forth. In a simple explanation, a blockchain is a summary of transactions from block to block summarized into hashes.

Hashes in a blockchian

What is a Hash in a blockchain? A hash function is a cryptographic method of encrypting data, which will output a hash value. The hash value will possess a unique identity which will remain the same as the input data. However, if there be any change to the input data, it will automatically result in a different hash value, separate from the first hash value that was created. The old hash value, plus the new data will be summarized and added to the next block of data in the blockchain, keeping it transparent.

How Does Blockchain Work?

Blockcahins are based on an active peer-2-peer network which interchanges every single block. Every user in the blockchain network has his own copy of the blockchain because they have the responsibility of creating new blocks of transactions that are added to the blockchain. However, not every transaction can be added to the next block on the blockchain. For instance, if A sends a coin to B, and no further transaction takes place, it will create a short node in the blockchain. And if in another instance X sends coins to Y, and it keeps going back and forth, it will create a longer chain, which by default will be favored and added to the blockchain network in preference of the shorter chain of block from A to B.

But blockchain wants to create a trust economy, or even better, a trustless economy, where every user can see and get added to the blockchain network no matter the weight of their transaction. To fix this, blockchain introduces mining or proof of work, the formal name for mining. Mining works as a consensus algorithm that allows a network or a miner to form a new block in the blockchain when they add a coin or more to the main pool where all transactions are stored. In turn, the main pool executes the transactions stored in it to form a new block on the blockchain. But suppose another miner comes in with plenty of coins, and throws it into the main pool, the blockchain network responds faster to the miner with bigger coins, and quickly executes the new block of transaction from the miner before attending to other miners with less coins. Notwithstanding, it's a win-win for either party.

In the blocks created by the miners, there's a nonce present in each block. This nonce is a random value that can be chosen by the miners. The nonce is brute-forced by the miners to get a hash value that is smaller than the main target, and if the hash value is small enough, the network will accept the new block and reward the miner. All the same, the network doesn't let every miner generate new blocks, but only those with a certain amount of investment or power consumption can generate new blocks, which happens at an estimated average of every 10 minutes.