What exactly is a Blockchain
The whole cryptocurrency industry is based upon one single technology, the blockchain. When we understand how a blockchain works, then we can be more effective in the way we use our cryptocurrencies but, we also understand how this kind of technology fits into our overall economy and everyday life.
Usually, people first hear about bitcoin and then that it is based on blockchain technology. At this point, we need to understand that a blockchain is not only related to bitcoin. If we use a metaphor here, we could say that bitcoin is just a video game, and the blockchain technology as a whole is a video game console.
There are many different blockchains like the Bitcoin, and Ethereum blockchains and each has its own properties but the fundamental technology stays the same.
Let’s take for a moment the computers and technology in general outside of the equation. Let’s say that we got together with five of our friends and went for a walk. We agree that when someone pays something for the group, then credit will be created between us.
Let’s say that one of our friends buys something, we then take a piece of paper each, and we write down that the person “a” bought this specific item for an “x” amount of dollars. After that, we will all agree that the above event took place. Any transaction that each one of us does creates the same entry into each other’s piece of paper.
If an external person tries to conscience one of us that a specific event never happened, then all the other friends will disagree, and they will make sure we stay on track with everybody else.
This is a very simplified concept of blockchain in the real world. Let’s now examine all the above concepts in depth.
Blocks — The “block” part of the word blockchain or what a blockchain contains.
Each new blockchain starts always with a “genesis block.” This is the first piece of information inside a blockchain. This block will always be the first one in this particular blockchain. All other blocks will go and attach themselves after this initial block. Each block inside a blockchain gets a unique id called a hash.
A block contains some data like a string, its previous block’s hash id, and of course, its own hash id. If someone were to change the data in one block, then its own hash would change, and then it won’t fit inside the blockchain.
Hash Cryptography & Secure Hash Algorithm 256 (SHA256) — The “chain” part of the word blockchain or the cryptographic ID that links all the blocks.
Hash is the individual id, or a fingerprint if you like, that each block in a blockchain has.
In 2001, the US National Security Agency (NSA), created the SHA256 algorithm to securely apply cryptography in various digital documents and passwords.
This hexadecimal (16 character system) hash id was derived from a combination of numbers from 0 to 9 and letters from A to F, it’s always 64 characters long, and it takes 256 bits in the memory of a computer (4 bits per character).
The hash id is created by taking into account the data contained in a block as well as the previous block’s hash number.
You can try adding cryptography to data by using the website https://passwordsgenerator.net/sha256-hash-generator/.
The Five Requirements
For it to work, a hash algorithm needs 5 requirements to be fulfilled.
- The first requirement makes sure that the cryptographic production of a hash is one-way. That means that is you decrypt a “hello world” text with a SHA256 id, and later on, you would like to reconvert this id into the initial text, it won't work.
- Secondly, the algorithm needs to make sure that when we convert the exact same data into a hash id twice, we get the same hash id. This is the deterministic requirement.
- A third requirement is concerning the speed at with data can produce a hash id. Speed plays a huge role in a huge blockchain with big data.
- The avalanche effect is the fourth requirement in the algorithm. This means that with any small change in the data we will get a completely different hash id.
- A hash algorithm needs to be secure. That means that an attacker should not be able to artificially change a block with a specific hash number with one of his or her own. So, the algorithms must withstand collisions, and that’s the fifth requirement.
Distributed P2P Network — The public use of blockchain in a Computer Network.
A blockchain, as we mentioned in our above example, can be used by many participants. Many can read and write inside a blockchain. All the participants need to be able to confirm each transaction as the participants could in our real-world example. This interaction is able through a distributed P2P network.
Every blockchain participant (node) gets a copy of every information contained in the blockchain in a cryptographic manner. This has as a result that an attack on one network participant will mean nothing in the grand scheme of the network.
This connectivity creates a huge and global computer network that interacts with the blockchain by reading and writing in it.
The network of the Bitcoin blockchain, for example, is global, meaning that there are participants in every part of the world, and it is decentralized meaning that for it to cease to exist we need to close every computer in the network and not some kind of a server.
All the above technologies combined create the “immutable ledger” of the blockchain. The information contained in a blockchain, once it is been created, cannot be altered.
Blockchains use also a high Byzantine fault tolerance percentage level to make sure the validity of the information in all of their blocks through a detailed list of checks that they performed.
Mining — Proof-of-work or how motivating the network participants.
Cryptocurrencies in blockchains that use “proof-of-work” can be “mined.” Mining simply adds one more field into the contains of a block named “nonce.” That has been there for the miners to fill.
In linguistics, a nonce word is a word that is not included in any dictionary and has been created in one particular moment just to fill in a communication gap. In the same sense, in blockchain mining, an arbitrary number that can be used just once has been created for the sole purpose of filling the “nonce” field inside a newly created block.
In each block, the content of the nonce field is being taken into account for the creation of its hash id number, and due to the avalanche effect, the hash id that has been created is entirely different from the one that the block will get without this field.
A network exists only if there are network participants, and in the case of a cryptocurrency, we need some kind of mechanism that when set in place, will somehow create, verify, and distribute the native token in the blockchain to its participants. Hash ids are simply numbers in the hexadecimal system. That means that there are smaller and there are greater hash numbers. When the mining mechanism is set into one blockchain, then a certain target is been set for the hash id of a block to be above, below, or exactly. The first market participant that will find which nonce number fits the target requirements of the mining mechanism, is been rewarded with a number of tokens.
Mining is a motivation mechanism that will put some stress in the creation and distribution of the native token inside a blockchain and help solve the Byzantine general fault tolerance problem by verifying the validity of the blocks.
Other Consensus Protocols — Other ways to motivate network participants.
The proof-of-work described above is just a single mechanism that a blockchain can use. Many blockchains use some unique proprietary consensus protocols, but the biggest protocols are two. Proof of work and proof of stake.
I personally translate the proof of work protocol as “participants need to work/solve equations to proof/verify the blocks” or, in other words, “rewarded by working.”
The proof-of-stake protocol is a different concept. Instead of “miners,” we have “forgers.” The validation of the blocks is achieved by which blockchain “stakes” the greatest number of validated blocks. If, for example, we have a part of a network that has validated a greater number of blocks, then statistically speaking, they have the “correct” blocks. The blocks are then copied to every blockchain node, and the process starts from the beginning.
Due to the security and validity of the information that a blockchain can contain, its use is limitless. The Ehereum blockchain is described as “the world’s computer” because its blocks can be programmable. Other blockchains can be used to validate real profiles from fake profiles on social media, other for government uses. The use cases are limitless.