The internet has once again surprised us with blockchain. We often talk about cryptocurrencies, Bitcoin, and other crypto-related topics. If you’re wondering, “What is a blockchain?” or “How does a blockchain work?” you’ve come to the right place.
In this article, we will learn all about blockchain, including how it works and how we use it in our daily lives.
So fasten your seat belts; it’s going to get bumpy.
The history of blockchain
Blockchain was first launched in 2008 as a public ledger that keeps records of Bitcoin transactions. This method of recording transactions is transparent. Every record is timestamped, immutable (meaning no one can change/delete a record after it was added), and decentralized.
A single person could have invented it or it could have been a group of people. Perhaps, it could even have been created by an artificial intelligence named Dorian Satoshi Nakamoto[1].
Back then, the word blockchain wasn’t thrown around as often as it is now. This ledger technology created by Satoshi Nakamoto helps solve some major problems. First, it supports peer-to-peer transactions and does not require intermediary services to process transactions. In addition, it solves the double-spending problem, which is usually seen in digital currencies rather than physical cash.
Double spending means that the same digital currency can be spent twice.
Around 2014, blockchain started to gain traction and attention. People started investing in it after seeing that it had more applications than just cryptocurrencies. It can be used in various fields such as insurance and finance, healthcare, voting, transportation, and more.
What is blockchain?
Blockchain is a distributed database or record-keeping system used to store digital records in a structure that is difficult to break into the system. Unlike traditional databases, blockchains do not store data in a centralized location. Instead, every node/computer on the network has a complete copy of the blockchain. When data is compiled on the system, it is distributed to thousands of network nodes.
How does blockchain work?
Blockchains store datasets in collections called blocks. Blocks are like containers. Each container has a limit or the maximum amount of content it can hold. In terms of blocks, the total amount of data it can contain is called the block size limit.
The capacity of each block is called the block size, and it varies depending on the blockchain (ranging from a few kilobytes to about a megabyte).
The block size of Bitcoin is about 1MB, and the block size of Ethereum is about 80KB.
Although block sizes may seem small, they can hold up to 2000 transactions. Each block is stored in linear and chronological order, and each new block is added to the end of the chain. When a block reaches its maximum block size, it is closed and connected to another block using a hashing algorithm, which is a cryptographic verification. Thus, a continuous blockchain is formed, giving rise to the blockchain. However, if a block exceeds the block size, it is rejected by the network and not added to the chain.
What makes a blockchain secure and immutable?
The immutability of the blockchain is due to the hash value of the blocks. A hash value is similar to a fingerprint. Humans all have different fingerprints. In the case of blocks, the hash value acts as a unique identifier/fingerprint. Each block is digitally signed by a unique hash value produced by a hash algorithm/hash function. The current block, the previous block, and a timestamp are used to generate these hashes, and a small change in the input will result in an entirely new hash.
The hash usually looks like this: 3a42c503953909637f78dd8c99b3b85ddde362415585afc11901bdefe8349102
Think of a hash function as a grinder. The grinder only works in one direction. It starts with a raw item and grinds it into small pieces. A hash function works similarly, it converts raw data into an encrypted format that cannot be reverse-engineered. There is no way to restore the original value from which the hash was generated, just as ground meat cannot be converted back to its original form after going through a grinder.
Suppose a hacker wants to alter a blockchain record. First, the hacker has to run his node and find the block he wants to modify. If he succeeds in altering the block/making the change, the newly generated hash will not match the original, making the block invalid on-chain.
Keep in mind that this modification is currently only available on his node. More importantly, before a record is added to the main public chain, it must be verified by other nodes. If a majority of nodes (at least 51%) confirm the validity of the proposed modification, it can be added to the chain; otherwise, it is considered invalid and rejected. So to do this, a hacker would need to make this exact change on most nodes/computers, which would be resource-intensive and practically impossible.
Features of Blockchain
- Decentralized. This is one of the key features of blockchain. With the exception of proprietary blockchains, blockchains do not have a central authority that manages network activity; instead, nodes maintain the network and verify transactions. You can store important digital assets on-chain and directly control these assets through your private key. Private keys are like cryptographically generated passwords that are used to sign transactions and prove ownership of blockchain addresses.
- Transparent and open. The blockchain publicly stores all records and transactions, and anyone can access them at any time. Blockchains are designed so that no one can cover up anything and use it for personal gain.
- Enhanced security and immutability. Every piece of data on the blockchain is hashed. That is, you cannot specify the actual content of the data. Also, it adds an extra layer of security since the hash cannot be reverse-engineered. And because of the advanced cryptography and uniqueness of block hashes, tampering with any block requires changing all the hashes of other blocks on most nodes. This is a lot of work and a lot of resources.
Blockchain terminology
Every technology has its own terminology, as we know it. Blockchain is no exception.
Cryptocurrency
When we hear cryptocurrency, the first word that comes to mind is Bitcoin. Cryptocurrencies are digital currencies/tokens. Just like physical cash, they can be used to buy and pay for services. Cryptocurrencies are built on blockchain and utilize blockchain technology as a security system and a public ledger that records all transactions. Each cryptocurrency has a unique and unalterable identification number that can be owned by a single person and cannot be duplicated in any way, reducing fraud.
Mining
Mining is a trend in the blockchain and cryptocurrency community, especially in the Bitcoin ecosystem. Mining is validating transactions and creating new blocks on the blockchain. Mining minerals such as gold and diamonds often requires large machines and resources. When mining a blockchain, a considerable amount of computing power is required to solve complex mathematical problems.
Mining is not only good for the blockchain but also profitable. Miners are rewarded in cryptocurrency for their efforts in validating transactions. Anyone can be a miner. All you need to do is download and run the mining software for your favorite blockchain, and you’re done! The types of mining are:
- Cloud mining
- Individual mining
- Pool mining
Mining consensus
Mining consensus is a fault-tolerant mechanism that blockchains use to make decisions. When the majority wins in such an agreement, the minority will support it. This ensures fair and faster decision-making. The two main consensus mechanisms of blockchain are:
1. Proof of Work (P0W)
2. Proof of Stake (PoS)
Proof of employment
The consensus mechanism requires miners to compete and prove their work (solving computations and creating new blocks) making them eligible to add new transactions to the blockchain.
The fastest person to solve the math puzzle wins the game and shares the new block with the rest of the network. Winners will receive cryptocurrency as a reward for their efforts.
The Bitcoin, Ethereum, and Litecoin blockchain networks use this mechanism.
Proof of Stake
In this consensus mechanism, miners must stake/reserve a certain amount of cryptocurrency to be randomly chosen to validate transactions. As with proof-of-work, miners share blocks with the network and earn cryptocurrency.
Compared to Proof of Work, Proof of Stake is less expensive and consumes less energy. Blockchains such as Ethereum plan to upgrade to PoS consensus protocols soon.
Node
A blockchain node is a computer or device that runs blockchain client software. It has a complete copy of the blockchain data and can verify transactions, messages, and blocks on the blockchain.
Node type
There are two main types of blockchain nodes; lightweight nodes and full nodes. There are various types of nodes. They are:
- Light Nodes
- Masternodes
- Pruned Full Nodes
- Archival Full Nodes
- Mining Nodes
- Lightning Nodes
Full Node and Lightweight Node
Full nodes validate transactions by downloading all transactions on the blockchain. In contrast, lightweight nodes keep a partial/basic list of blockchain transactions (mainly block headers), not the entire transaction history. A full node can be set up in the cloud or run locally.
How to run a node
Running your own node is very simple:
- Choose a blockchain (eg, Bitcoin, Ethereum, etc.).
- Download the client software for your favorite blockchain. The client will connect to all other peers/nodes/computers running the same client software and will copy the blockchain from them.
Types of Blockchains
Blockchains are divided into two main types: permissioned and permissionless. However, there are several variants, each with specific functionality. Let’s take a closer look at each of them:
- Private blockchain (permissioned blockchain)
- Public blockchain (permissionless blockchain)
- Hybrid Blockchain
- Consortium Blockchain (Joint Blockchain)
Public blockchain (permissionless blockchain)
Public blockchains, also known as permissionless blockchains, are completely decentralized and open to the public. Any random person can add data and join the network as a node, participate in transaction verification, etc.
Advantages of public blockchains
- Data on the blockchain is immutable
- Anyone is free to join
- High data security
- Transactions are easy to track
- They are completely transparent
- Validators on the blockchain remain anonymous
- It is fully decentralized (eliminates all central authorities)
Disadvantages of public blockchains
- Transactions are slow. Due to the many active users, it takes longer to complete transactions on this public network.
- Extensibility. There are hundreds of nodes, most of which are validating transactions, causing transaction delays. For companies that need fast response/transaction confirmation, public blockchains may not be the most appropriate solution.
- Resource consumption is high. As public blockchains perform heavy algorithmic computation and mining, they require more storage and greater computing power and electricity.
Private blockchain (permissioned blockchain)
Companies providing services often interact with third-party services, resulting in extended processing times. Therefore, these businesses need a blockchain:
- Private
- Safe
- Fully licensed
- Quick
This is where private blockchains come into play.
Unlike public blockchains that allow anyone to become a node and interact with the network, private blockchains are fully permissioned and require every node to be verified before joining the network, allowing only a few authenticated individuals to become nodes and interact with the blockchain.
These types of blockchains are often run by an agency known as a trusted middleman, who has the power to change the content of the blockchain.
Examples of private blockchains are:
- Ripple (XRP)
- Hyperledger
- R3 Cord
Advantages of private blockchains
- The network is stable. Private blockchains have more stable networks.
- Transaction costs are low. Transaction costs are low because there are not many users on the network.
Disadvantages of Private Blockchains
- Trust issues. Because we don’t know what’s going on, it can be difficult for people outside the network to trust the network without access to it. Additionally, fraudulent transactions can occur, reducing trust in the blockchain.
- Centralized control. Rules are set by a single entity or group of people on the network, defeating the purpose of decentralization.
- Limited accessibility. Not everyone can use this type of blockchain. You can only access if you are invited.
Hybrid Blockchain
Hybrid blockchains are peculiar. Although licensed or controlled, they provide freedom. If you’ve ever crossed a wolf and a human to create a werewolf, you should have a deep understanding of hybrid blockchains.
Hybrid blockchains combine the properties of private and public blockchains. You must have a special invitation to access this database, and sometimes blockchain members decide who to add to the blockchain. Still, it ensures transparency, freedom, and security. Some activities are confidential; while others are open to the public (accessible only to blockchain members).
Advantages of Hybrid Blockchain
- Safety. Since access to such blockchains requires special access rights, the blockchains are protected from external hackers.
- Privacy. The network operates in a closed ecosystem; therefore, data is secure and private.
- Ensure trust
- Faster transaction times
Consortium Blockchain (Joint Blockchain)
Consortium blockchains, like hybrid blockchains, are a mix of public and private blockchains. The only difference is that members from multiple organizations can collaborate on the network instead of a single person.
Consortium blockchains are essentially private blockchains with limited access to the organization. This eliminates the need for a centralized control structure, enabling banks to cooperate in validating transactions.
A Star Is Born – Ethereum Blockchain
The number of companies and individuals with game-changing ideas that leverage the power, security, and transparency of blockchain is growing day by day. New platforms are emerging all the time, each with specific problems to solve.
Vitalik Buterin is a young Russian-Canadian developer who came out and published a white paper in 2013 with a very innovative idea. He proposed a blockchain capable of running computer code. Are you crazy? Thus, the Ethereum project was born.
Unlike the Bitcoin chain, which is more closely tied to the Bitcoin cryptocurrency, the Ethereum blockchain has additional cool features. Let’s look at a few of them:
Smart Contract
The Ethereum blockchain works just like a traditional blockchain, but it enables developers to write computer programs that can execute according to predefined rules or events on the blockchain. These computer programs run on the Ethereum blockchain and are called smart contracts. Smart contracts are primarily written in an object-oriented programming language called Solidity.
Solidity’s syntax is similar to C++ or JavaScript.
Tokens and NFTs
Although the Ethereum blockchain has its own cryptocurrency, ether (ETH), it allows developers to create tokens that function like cryptocurrencies. They can be traded, etc.
There is a unique kind of token called a Non-Fungible Token (NFT). These tokens represent real-life digital assets such as music, videos, and photos. NFTs provide creators the ability to legally own and sell content with fair profits and royalties.
Practical applications of blockchain
Although blockchain is designed to store a ledger of records and is often used in cryptocurrencies such as Bitcoin, it has a wide range of real-world applications, from finance to data ownership.
Money Transfer
It may take several days to transfer funds to other accounts. When making cross-border transactions, it takes significantly longer. However, blockchain transfers can take minutes or even seconds because there is no intermediary service and the transaction happens directly between the parties involved.
Royalty and Piracy
Blockchain can track the distribution of movies, music and other artist/creator content across streaming platforms and across the internet. Through automated smart contracts, creators can get paid when their content is used.
Non-Fungible Tokens (NFTs)
NFTs are non-transferable digital assets that represent physical objects. NFTs can be anything digital, such as music, images, or videos. Furthermore, since blockchain ensures that there is only one instance of a digital item, creators can claim full ownership of their content.
Medical insurance
Healthcare organizations can also use blockchain technology to keep patient records and share documents with researchers and drug providers.