Table of contents
The internet surprised us once again with the blockchain.
We frequently hear of this word regarding cryptocurrencies, Bitcoin, and other crypto-related topics.
And if you're wondering, "What is a blockchain?" or "How does the blockchain work?" You've come to the right place.
In this article, we'll learn everything there is to know about the blockchain, including how it works and how we can use it in our daily lives.
So fasten your seatbelts; it's going to get bumpy.
History of blockchain
The blockchain was first introduced in 2008 as a public ledger for keeping records of transactions for Bitcoin. This method of recording transactions was transparent. Every record was timestamped, immutable (meaning no one could change/remove a record after it had been added), and decentralized.
It was invented by a guy or probably a group of people, or even an AI who goes by the name Dorian Satoshi Nakamoto.
At the time, the word blockchain wasn't frequently tossed around as it is now. This ledger technology created by Satoshi helped solve a few major problems. First, it enabled peer-to-peer transactions, where there's no need for intermediary services to process transactions. Also, it solved the double-spending problem, which is a problem that usually occurs in digital currencies and not physical cash.
Double-spending is when the same digital currency can be spent twice.
Around the year 2014, the blockchain started to gain traction and attention. People began to invest in it after seeing that it had more applications than just cryptocurrency. It could be used in various fields such as insurance and finance, healthcare, voting, transportation, and others.
What is a blockchain?
The blockchain is a distributed database or record-keeping system for storing digital records in a structure that makes it difficult to hack the system. The blockchain does not store data in a centralized location, unlike a traditional database. Instead, each node/computer on the network has a complete copy of the blockchain. When data is saved on the system, it is distributed to thousands of network nodes.
How does the blockchain work?
The blockchain stores sets of data in collections known as blocks. Blocks are like containers. Every container has a limit or a maximum amount of content it can hold. In terms of blocks, the total amount of data it can contain is known as block size limit
The capacity of each block is referred to as the block size, and it varies depending on the blockchain (ranging from a few kilobytes to roughly 1 megabyte).
The block size of Bitcoin is around 1MB, and that of Ethereum is roughly 80KB.
Although the block sizes appear small, they can carry up to 2000 transactions. Every block is stored linearly and chronologically, with each new block added to the end of the chain. When a block reaches its maximum block size, it’s closed and connected to another block using a hashing algorithm, a type of cryptographic validation. As a result, a continuous chain of blocks is formed, giving rise to the name blockchain. However, if a block exceeds the block size, the network rejects it and is not added to the chain.
What makes the blockchain secure and immutable?
The immutability of the blockchain is due to the hashes of the blocks. A hash is similar to a fingerprint. Humans all have different fingerprints. In the case of blocks, hashes serve as unique identifiers/fingerprints. Each block is digitally signed with a unique hash generated by a hashing algorithm/a hash function. The current block, the previous block, and a timestamp are used to generate these hashes, and the slightest change of input will result in a whole new hash.
Hash values normally look like this: 3a42c503953909637f78dd8c99b3b85ddde362415585afc11901bdefe8349102
Think of a hash function as a grinding machine. A grinding machine only works in one direction. It starts with a raw item and grinds it down into smaller pieces. A hash function functions similarly in that it takes raw data and converts it into an encrypted format that cannot be reverse-engineered. There is no way to recover the original values generated into the hash, just as ground meat cannot be converted back to its original form after passing through a grinding machine.
Assume a hacker wanted to change a blockchain record. First, the hacker must run his node and locate the block he wants to modify. If he is successful in changing this block/making this change, the newly generated hash will not match the original hash, rendering the block invalid in the chain.
Keep in mind that this modification is currently only available on his node. What's more, before a record is added to the main public chain, it must be verified by the other nodes. If the majority of nodes (at least 51 per cent) confirm the validity of the new change, it can be added to the chain; otherwise, it is considered invalid and rejected. As a result, for this to be possible, the hacker will need to perform this exact change on most nodes/computers, which will require a large number of resources and is practically impossible.
Characteristics of blockchain
Decentralized. This is one of the key features of the blockchain. Except for private blockchains, the blockchain does not have a central authority managing the network's activities; instead, the nodes maintain the network and validate transactions. You can store your important digital assets on the chain, and you have direct control over these assets via your private keys. Private keys are like cryptographically generated passwords used for signing transactions and proving ownership of a blockchain address.
Transparent and open. The blockchain stores all records and transactions publicly, making them accessible to anyone at any time. The blockchain is 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. Furthermore, since the hashes cannot be reverse-engineered, it adds an extra layer of security. And because of the advanced cryptography and uniqueness of the block hashes, tampering with any block will require changing all the hashes of the other blocks on the majority of the nodes, which is a lot of work and a lot of resources.
As we all know, every technology comes along with its geeky terms. The blockchain is no exception.
When we hear of cryptocurrencies, the first word that mostly comes to mind is Bitcoin. Cryptocurrencies are digital currencies/tokens. And just like physical cash, they can be used to make purchases and pay for services. Cryptocurrencies are built on top of the blockchain and utilize blockchain technology as a security system and a public ledger for recording all transactions. Every cryptocurrency has a unique unchangeable identification number that can be owned by one person and cannot be duplicated in any way, thereby reducing fraud.
Mining is trendy in the blockchain and crypto communities, particularly the Bitcoin ecosystem. Mining is verifying transactions and creating new blocks onto the blockchain. Mining minerals such as gold and diamond usually require large machines and resources. A considerable portion of computing power is needed to solve complex mathematical problems when mining blockchains.
Mining not only benefits the blockchain but is also profitable. Miners are rewarded in cryptocurrency for their efforts in verifying transactions. Anyone can be a miner. You just need to download and run the mining software for your preferred blockchain, and you're done! The types of Mining are:
Mining consensus is a fault-tolerant mechanism used by the blockchain to make decisions. When the majority wins in this type of agreement, the minority supports it. This ensures fairness and faster decision-making. The two main consensus mechanisms of the blockchain are:
A consensus mechanism requires miners to compete and demonstrate that their work (solving computations and creating new blocks) qualifies them for the right to add new transactions to the blockchain.
The fastest to solve the mathematical puzzle wins the competition and shares the new block with the rest of the network. The winner receives cryptocurrency as a reward for their efforts.
This mechanism is used by the Bitcoin, Ethereum, and Litecoin blockchain networks.
In this consensus mechanism, miners must stake/set aside a certain amount of cryptocurrency to be randomly selected to verify transactions. In the same way as proof-of-work, the miner shares the block with the network and earns cryptocurrency.
In comparison to proof-of-work, proof-of-stake is less expensive and uses less energy. Blockchains such as Ethereum plan to upgrade to the PoS consensus protocol soon.
A blockchain node is a computer or device that runs blockchain client software, has a complete copy of the blockchain data, and can validate transactions, messages, and blocks on the blockchain.
Types of nodes
Blockchain nodes are classified into two main kinds; Lightweight nodes and Full nodes. There are a variety of types of nodes. They are:
Pruned Full Nodes
Archival Full Nodes
Full nodes vs Lightweight nodes
Full nodes validate transactions by downloading all transactions on the blockchain. In contrast, lightweight nodes keep a partial/essential list of blockchain transactions (mainly the block headers) rather than the whole transaction history. A full node can be set up on the cloud or run locally.
How to run a node
Running your own node is super simple:
Choose a blockchain (e.g., Bitcoin, Ethereum, etc.).
Download the client software of your preferred 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 classified into two main types: **permissioned **and permissionless. However, there are several variations, with each serving a specific function. Let us take a closer look at each of them:
Private blockchains (Permissioned Blockchains)
Public blockchains (Permissionless Blockchains)
Consortium blockchains (Federated blockchains)
Public blockchains (Permissionless Blockchains)
Public blockchains, also known as permissionless blockchains, are fully decentralized and open to the public. Any random person can add data and join the network as a node to participate in transaction validation and so on.
Advantages of public blockchains
Data on the blockchain is immutable
Anyone is free to join
High data security
Transactions are easily traceable
They are fully transparent
The validators on the blockchain remain anonymous
It is entirely decentralized (eliminates all central authorities)
Disadvantages of public blockchains
Slow transactions. Due to many active users, transactions take longer to complete on this public network.
Scalability. There are hundreds of nodes, with most of them verifying transactions, resulting in delayed transactions. Public blockchains may not be the best solution for a company that requires fast response/transaction confirmations.
Heavy resource consumption. Because public blockchains perform heavy algorithmic calculations and mining, they require more storage and greater computational power and electricity.
Private blockchains (Permissioned Blockchains)
Companies that provide services frequently interact with third-party services, resulting in extended processing times. As a result, these businesses need a blockchain that is:
This is where private blockchains come into play.
Unlike public blockchains, which enable anybody to be a node and interact with the network, private blockchains are fully permissioned and require each node to be validated before joining the network, allowing only a few authenticated individuals to become nodes and interact with the blockchain.
These types of blockchains are usually run by an authority known as the trusted intermediate, who has the power to alter the content of the blockchain.
Examples of private blockchains are:
Advantages of private blockchains
Network stability. Private blockchains have a more stable network.
Low transaction cost. Transaction costs are meager because there aren't many users on the network.
Disadvantages of private blockchains
Trust issues. Because we don't know what's going on, it may be difficult for those outside the network who don't have access to the network to trust the network. Furthermore, fraudulent transactions may occur, reducing trust in the blockchain.
Centralized control. Rules are established by a single entity or a group of people on the network, which somewhat defeats the purpose of decentralization.
Limited accessibility. This type of blockchain is not available to everyone. You can only have access if you're sent an invitation.
Hybrid blockchains are peculiar. Despite being permissioned or controlled, they offer freedom. You should have a good idea of what hybrid blockchains are if you've ever crossed a wolf and a man to create a werewolf.
Hybrid blockchains combine the features of both private and public blockchains. You must have a special invitation to access this database, and sometimes the blockchain members decide who to add to the blockchain. Still, it ensures transparency, freedom, and security. Some activities are kept private; whiles others are open to the public (only accessible by members of the blockchain).
Advantages of hybrid blockchains
Security. Since access to this type of blockchain requires special access, it protects the blockchain from external hack attacks.
Privacy. The network works in a closed ecosystem; hence, data is secure and private.
Faster transaction times
Consortium blockchains (Federated blockchains)
Consortium blockchains, like hybrid blockchains, are a mix of the two public and private blockchains. The only difference is that members from multiple organizations can collaborate on the networks instead of single individuals.
Consortium blockchains are essentially private blockchains with restricted access to organizations. This eliminates the need for a centralized control structure and is appropriate for banks working together to validate transactions.
A star is born - Ethereum blockchain
The number of companies and individuals with game-changing ideas leveraging the blockchain's power, security, and transparency is growing by the day. New platforms continue to emerge, each with a specific problem to solve.
Vitalik Buterin, a young Russian-Canadian developer, came out in 2013 and published a white paper with a very excellent idea. He proposed a blockchain capable of running computer code. Isn't it crazy?! As a result, The Ethereum Project was born.
Unlike the Bitcoin chain that is more closely connected to the bitcoin cryptocurrency, the Ethereum blockchain comes with extra cool features. Let's look at a few of them:
The Ethereum blockchain works just like a traditional blockchain, but it enables developers to write computer programs that can execute depending on 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.
Tokens and NFTs
Even though the Ethereum blockchain has its cryptocurrency, Ether (ETH), allows developers to create tokens that function just like cryptocurrencies. They can be traded, and so on.
There are unique tokens known as Non-Fungible Tokens (NFTs). These tokens represent real-life digital assets such as music, videos, and photos. NFTs have provided creators with the ability to rightfully own their content and sell them while having a fair share of profits and royalties.
Real-world applications of blockchain
Even though the blockchain was designed as a ledger for storing records and is often used for cryptocurrencies such as bitcoin and others, it has a wide range of real-world applications ranging from finance to data ownership.
Transferring funds to other accounts can take several days. When conducting cross-border transactions, it takes noticeably longer. However, blockchain transfers can take minutes or even seconds because there are no intermediary services, and the transaction occurs directly between the parties involved.
During elections, we stand in long queues to cast our votes. However, this could be simplified with the help of blockchain technology. With the blockchain capable of keeping our records, platforms can utilize this technology to build blockchain-powered services that determine whether a person is eligible to vote. A person has voted twice, or a vote is valid. A solution like this would fasten the voting process and lower the cost of running elections.
Internet Of Things (IoT)
IoT refers to physical devices that include sensors and can process data from their surroundings. Do you remember Javis and Alexa? These devices can manage home security systems, monitor our health, operate factory equipment, and so on. We frequently hear about these gadgets being hacked to spy on people and take remote control of other devices. But because of data openness and immutability/incorruptibility, blockchain provides a significantly better level of security to prevent data breaches.
Here is a list of companies that are leveraging blockchain technology to make IoT smarter and safer:
Royalties and piracy
The blockchain can track the distribution of films, music, and other artist/creator content across streaming platforms and all over the internet. Through automated smart contracts, creators can be paid when their content is used.
Non-fungible tokens (NFTs)
NFTs are non-transferable digital assets that represent physical items. NFTs can be anything digital, such as music, images, or videos. Furthermore, because the blockchain ensures that there is only one instance of a digital item, creators can claim complete ownership of their content.
Healthcare institutions can also utilize blockchain technology to keep records of patients and share documents with researchers and drug providers.
That's all, folks. Thanks for reading 😇🙌
If you're interested in learning more about web3 development, these are some popular, free resources:
* NFT series on Ethereum.org's website -- this is 3 part series that's a popular beginner tutorial on Ethereum's website
* Patrick Collins' 30+hr Youtube -- this is the OG, most complete web3 development Youtube video"
If you loved this article, check out Hashnode's Web3 blog to learn more about other topics in this space.