- Blockchain Explained with Marbles: Blockchain technology is a complex system but can be understood through a simplified analogy of kids trading marbles. Imagine each kid has a notebook recording every marble trade. These notebooks represent a blockchain ledger, where every transaction is verified by everyone involved before being added to a permanent record.
- Key Components of Blockchain: The core components of a blockchain include a distributed ledger (shared record), blocks (data containers), cryptographic hashing (unique identifiers for data), consensus mechanisms (agreement on transaction validity), and a peer-to-peer network (distributed ledger across devices). These components work together to create a secure, transparent, and tamper-proof system.
- Understanding Consensus Mechanisms: Consensus mechanisms ensure agreement among participants on the validity of transactions. The article explores three common mechanisms: Proof of Work (solving puzzles to validate transactions), Proof of Stake (using cryptocurrency holdings for validation rights), and Delegated Proof of Stake (elected delegates validate transactions).
Diving into the world of blockchain technology can be daunting, especially given the complex terminology accompanying it. Yet, for anyone with a stake in the web3 landscape, it’s important to possess a solid understanding of the underlying technology. This empowers you to decide which projects to support, leverage, or invest in.
This article will demystify blockchain technology, breaking down its components and clarifying how they interact by using an analogy of kids trading marbles in a schoolyard. By the end, you’ll not only be sick of marbles but you’ll be equipped with the knowledge to confidently navigate the realm of blockchain, regardless of your objective.
What is a blockchain?
Blockchain is a distinctive, shared database that stores data in cryptographically linked blocks, serving as a decentralized and immutable ledger primarily used for transactions. Notably used by Bitcoin, this structure allows control to be collectively retained by all users rather than being centralized in a single group or individual. The decentralized nature of blockchains ensures that data entered, such as Bitcoin transactions, is irreversible and permanently recorded, making it transparent and viewable to anyone. It was initially introduced in 1982 by David Chaum.
To put it simply, imagine you have a special notebook called a blockchain. But instead of just you having the notebook, all your friends have their own copies. Whenever someone does something, like buying, selling, or trading marbles, they write it down in their notebook. Everyone’s notebook is connected and updated at the same time. So, if someone tries to change what they wrote, everyone else will notice and call them out. This way, we can all trust that the information in the notebooks is true and nobody can cheat.
The components of the blockchain:
A blockchain typically consists of several core components that work together to make it function. Here are the key components:
1. Distributed Ledger: The distributed ledger is at the heart of a blockchain. It is a digital ledger that records all transactions or data entries across multiple nodes or computers within the network. Each participant maintains a copy of the ledger, and updates are achieved through consensus mechanisms.
photo credit: imi blockchain
2. Blocks: A blockchain is a chain of blocks where each block contains a set of transactions or data entries. Each block is linked to the previous block through a cryptographic hash, creating an immutable and chronological chain of data.
3. Cryptographic Hashing: Cryptographic hash functions are used to secure the integrity of data within a block and establish connections between blocks. Hash functions generate a unique fixed-size output (hash) for any given input data. Changing the input even slightly will result in a completely different hash, making it extremely difficult to tamper with the data.
4. Consensus Mechanism: Consensus mechanisms ensure agreement among network participants on the state of the blockchain and the order of transactions. They enable nodes to reach a consensus on which transactions are valid and should be added to the blockchain. Popular consensus mechanisms include Proof of Work (PoW), Proof of Stake (PoS), Delegated Proof of Stake (DPoS), and Practical Byzantine Fault Tolerance (PBFT).
photo credit: Ledger Academy
5. Peer-to-Peer Network: Blockchain operates on a peer-to-peer (P2P) network, where each participant (node) maintains a copy of the entire blockchain and communicates with other nodes. P2P networking enables the distribution of the blockchain across multiple nodes and ensures redundancy, fault tolerance, and decentralized control.
These components work in conjunction to create a decentralized, secure, transparent, and tamper-resistant system, which is the essence of blockchain technology.
photo credit: geeksforgeeks.org
Making sense of the above
Alright, keeping with the notebook analogy, let’s imagine you’re in school and have a notebook where you keep a record of all the marbles you trade with your friends during recess. Each trade you make is like a transaction. So let’s say you trade your blue marble for your friend’s green marble – you’d write this down in your notebook as a transaction: “Traded my blue marble for a green marble with Sam.”
Now, imagine instead of just you keeping a record in your notebook, all of your friends also write down this trade in their own notebooks. These notebooks are like the blockchain. Every time a trade happens, everyone writes it down.
Now, let’s say you want to make another trade. This time, you want to trade your newly acquired green marble for a red marble from your friend Alex. You tell everyone about this trade, and they all write it down in their notebooks too. But before they write it down, they all check their notebooks to make sure you really do have a green marble to trade. They find the record of your previous trade with Sam and confirm that you do indeed have a green marble. Then, they write down your new trade.
In this way, every trade or transaction triggers a new event on the blockchain. Everyone checks their notebooks (the blockchain) to make sure the trade is valid, and then they record the new transaction. The whole process is done in the open where everyone can see, making it fair and safe for everyone involved.
So, you and your friends are trading marbles and writing down every trade in your notebooks. After a while, the pages of the notebooks start to fill up with these trades. When a page gets filled, you can think of it as a ‘block’ of trades. Once a page is full, you start a new page or a ‘new block‘.
Now, imagine that every time a page gets filled up before you can start a new page, you have to solve a little puzzle. This puzzle could be a riddle or a math problem. The first person to solve the puzzle gets to read out their page to everyone else. If everyone agrees that all the trades on the page are correct and that the puzzle was solved correctly, this is like the ‘consensus algorithm’ agreeing that the block is valid.
Once everyone agrees, they add a copy of that page (or ‘block’) to a binder (our ‘blockchain’). Everyone has their own binder, so everyone has a copy of all the trades that have happened. Also, everyone writes down the answer to the puzzle at the top of the next page. This is like the ‘cryptographic hash‘ that links one block to the next.
Once the new block is added to the binder, everyone moves on to the next page in their notebook, and the process starts again. This marks the end of that ‘transaction’ of adding a new block to the chain.
So, each block is like a page of trades, and the whole binder is like the full record of all the trades. The puzzles and the agreement between everyone make sure that no one can cheat or change the trades once they’re in the binder.
What does it mean to Validate a transaction?
In the marble trading example, “validating a transaction” is like when you announce a new trade (say, trading your green marble for Alex’s red marble), and before anyone writes it down, they first check their own notebooks. They’re looking to confirm that you really do have a green marble to trade. If they find the record of your previous trade with Sam, where you got a green marble, then they know your new trade is valid because you really do have a green marble.
This process of checking the previous records (or transactions) to confirm the validity of a new transaction is the “validation” part. In a real blockchain, this is done by nodes in the network. They look at the history of transactions in their copy of the blockchain to ensure that the new transaction is legitimate. If it is, they approve or validate it, and it can be added to a new block.
photo credit: Wall Street Mojo
Ok, well, what is consensus, and why are nodes trying to achieve it?
In the marble trading example, the “consensus” part happens when a page in the notebook (or a block of transactions) is full, and a puzzle has been solved.
When one of your friends solves the puzzle, they announce it to everyone and read out all the trades on their page. Everyone else checks their notebooks to ensure all those trades match what they have written down. They’re also checking to make sure the puzzle was solved correctly.
If everyone agrees that everything matches and is correct, that’s consensus. It’s the group collectively agreeing that everything is valid and correct.
In terms of blockchain, consensus algorithms are the rules that guide this process. They help all the nodes in the network to agree on the validity of transactions and blocks. This is crucial because it ensures that every copy of the distributed blockchain is the same, maintaining the integrity and security of the blockchain. Different blockchain networks may use different consensus algorithms, but the goal is always to ensure agreement across all nodes in the network.
By reaching a consensus, nodes collectively contribute to the blockchain network’s security, stability, and trustworthiness. Consensus mechanisms provide a way to establish a decentralized and tamper-resistant consensus, enabling blockchain networks to operate reliably without relying on a central authority.
What are some consensus mechanisms?
1. Proof-of-Work (PoW): PoW is a consensus mechanism where participants, known as miners, compete to solve complex mathematical puzzles to validate transactions and create new blocks. The miner who solves the puzzle first gets to add the next block and is rewarded. PoW is resource-intensive, requiring significant computational power, and it ensures that the majority of honest participants control the blockchain.
In our marble trading example, the “Proof of Work” concept can be represented by the puzzle-solving task that needs to be done before a new page (or block) can be started.
Photo credit: iStock Photos
When a page in the notebook (representing a block of transactions) is filled up, that puzzle (math equation) appears. This is where the “work” comes in – to add a new page to the notebook, someone has to solve this puzzle. This requires effort and time, just like solving complex mathematical problems in the actual blockchain requires computational power and energy.
The first person to solve the puzzle (or to show ‘proof of work’) gets to read out their page to everyone else. If everyone agrees that all the trades on the page are correct and the puzzle was solved correctly, then the page (or block) is added to everyone’s binders (or blockchain).
This puzzle-solving process is essentially a competition, and it’s what keeps the system secure. It’s hard to solve the puzzle (just like it’s computationally difficult to find a new block in the real blockchain), but it’s easy for others to check the work once it’s done.
In the real-world application of Bitcoin, for example, the “puzzle” is a complex mathematical problem and the “work” is the computing power expended by the nodes (miners) in the network to solve that problem. The node that solves the problem gets to add the new block of transactions to the blockchain and is rewarded with some bitcoins. This is known as mining.
2. Proof-of-Stake (PoS): In PoS, the right to create blocks and validate transactions is determined by the ownership or “stake” of a cryptocurrency. Participants with a higher stake have a higher chance of being selected to create blocks. PoS consumes less energy compared to PoW and is considered more environmentally friendly.
In the marble trading scenario, “Proof of Stake” could be represented in a different way.
Let’s say instead of solving a puzzle to add a new page to the binder, the person who gets to do it is chosen based on how many marbles they have or their ‘stake’ in the marble trading game. The more marbles a person has, the more likely they are to be chosen to add a new page to the binder.
When a page in the notebook is filled, everyone reveals how many marbles they have. The person with the most marbles gets to read out their page to everyone else. If everyone agrees that all the trades on the page are correct, the page (or block) is added to everyone’s binders (or blockchain). To make sure the same person doesn’t always get to add the pages, we could add a rule that says the same person can’t add pages two times in a row.
This system encourages everyone to act honestly. If someone tries to cheat or mess up the system, they would be putting their own marbles at risk. Because the more marbles they have, the more they have to lose if they’re caught cheating. This is similar to how Proof of Stake works in blockchain: those who hold more of the cryptocurrency (or have a larger ‘stake’) have more power when it comes to adding new blocks to the blockchain, but they also have more to lose if they attempt to deceive the system.
In real-world blockchain systems, Proof of Stake also includes complex mechanisms to ensure security and fairness, such as random selection processes and penalties for dishonest behavior. The analogy simplifies these aspects for easier understanding.
3. Delegated Proof-of-Stake (DPoS): DPoS introduces a voting-based consensus mechanism where stakeholders in a blockchain network elect a limited number of trusted nodes, called delegates, to validate transactions and create blocks on their behalf. DPoS achieves faster transaction confirmation times and higher scalability compared to PoW and PoS. However, it introduces some centralization since a small set of delegates has more decision-making power.
photo credit: SlideTeam
DPoS, in the marble trading analogy, could be represented as follows: instead of everyone revealing their marble count each time a page is filled, the group decides to elect a few trusted friends who will take turns adding pages to the binder. These friends are chosen (or “delegated”) based on the number of marbles each person in the group has – the more marbles you have, the more votes you get to cast in electing these trusted friends.
photo credit: iStock Photos
Once chosen, these delegates are responsible for validating transactions and adding new pages to the binder. The rest of the group still checks their work to ensure honesty, and if a delegate is found to be dishonest or unreliable, they can be voted out in the next election round.
In a real-world DPoS blockchain, token holders use their tokens to vote for a certain number of delegates, who then validate transactions and add new blocks to the blockchain. This method is often faster and more efficient than traditional PoS or PoW systems, but it relies heavily on the honesty and reliability of the chosen delegates.
4. Practical Byzantine Fault Tolerance: Practical Byzantine Fault Tolerance (PBFT) is a consensus algorithm that’s designed to work even if some participants (or nodes) are unreliable or malicious.
Let it be known that the Byzantine fault Tolerance stems from an analogy based on the “Byzantine’s General Problem”. There was no way to smoothly incorporate soldiers into the marble analogy, so, unfortunately, you will be subjected to more marble talk.
In the context of our marble trading analogy, it would work like this:
We would still have our group of friends trading marbles and keeping track of the trades in their notebooks. But instead of solving puzzles or counting marbles to add pages to the binder, we would use a different process.
Let’s say when a page is full, you, as the owner of the binder, propose a new page with all the trades you’ve recorded. But instead of adding it to the binder right away, you first send a copy of the page to each of your friends for them to check. Each of them, after checking the page against their own notebook, sends a message back to you saying whether they agree with your page or not.
Here’s the key part: you need to get a certain number of agreements (more than two-thirds of the group, for example) before you can add the page to the binder. If you don’t get enough agreements, you can’t add the page and have to figure out what went wrong.
Now, what if some of your friends are trying to mess up the game by lying about their trades or sending false messages? The PBFT system can handle this. As long as fewer than one-third of your friends are dishonest, you’ll still get enough honest responses to be able to add the page to the binder. This is the “fault tolerance” part – the system can tolerate some amount of bad behavior and still work correctly.
In the real world, PBFT is a consensus algorithm used in some blockchain systems. It involves a complex process of pre-preparation, preparation, and commitment phases in which nodes in the network propose, validate, and agree upon new blocks to be added to the chain. It’s designed to work even if some nodes are faulty or malicious as long as the number of such nodes is less than one-third of all nodes in the system.
Additional Terminology
Although the above is a more-than-adequate foundation from which to build, there are a few other terms that you’ll find popping up during your regular web3 escapades that should be addressed. Let’s take a look at some and see if we can relate them to the marble analogy.
Mempool: When a user initiates a transaction on a blockchain, it is first broadcasted to the network and enters a temporary storage area called the mempool (short for memory pool). The mempool contains a collection of unconfirmed transactions waiting to be included in a block.
In our marble analogy, a mempool (memory pool) would be like a waiting area or a “holding pen” for marble trades that have been proposed but not yet recorded in the binder.
photo credit: byjus.com
Let’s say you and your friends are trading marbles so fast that the person holding the binder can’t keep up. To manage this, you set up a special box where anyone who makes a trade puts a note with the details of their trade. This box is your mempool.
In this box, all the notes about marble trades are waiting to be added to the binder. Sometimes, there might be more trades happening than there are pages in the binder, so some trades have to wait. The person with the binder would then pick notes from the box (mempool) one by one and add them to the binder when there’s space.
Just like with real blockchain transactions, there might be a priority order for picking these notes. For example, trades where people have agreed to give up a little extra marble (akin to higher transaction fees in blockchain), might be picked first.
Miner: In the marble trading game, a miner would be the friend who’s responsible for adding new pages to the binder and validating the trades. This friend takes on the job of checking all the trades in the mempool (the box of proposed trades), ensuring they follow the rules, and then adding them to the binder.
This “miner” friend would also be the one who solves the puzzle or completes the task (akin to the “proof of work” in real blockchain systems) necessary to add a new page to the binder. In real blockchain systems, this involves complex mathematical calculations, but in our marble game, it could be something simpler, like completing a sudoku or finding a specific marble.
Once the miner completes the task, they add a new page to the binder with all the validated trades from the mempool, and the process starts again. In return for their work, they might receive some new marbles as a reward (akin to the way miners are rewarded with new bitcoins in the Bitcoin system).
Node: In our marble trading analogy, each of your friends (including you) who are involved in trading and recording the trades in their notebooks can be considered a ‘node’.
In the context of a blockchain, a node is a participant in the network that maintains a copy of the blockchain and, in many cases, processes transactions. Nodes collectively maintain the network by sharing information with each other. So, when we talk about everyone keeping their own notebook of trades or everyone having their own binder, we’re talking about how every node has a copy of the blockchain. The act of everyone checking their notebooks before validating a trade is an illustration of how nodes in a blockchain network verify transactions.
photo credit: Seba Research
Immutable: In our marble trading game, when we say the records in the binder are “immutable“, it means that once a trade has been written down on a page and that page has been added to the binder, no one can change or erase what’s been written.
For instance, if you traded your blue marble for your friend’s red marble and that trade was written down and added to the binder, you can’t later go back and say, “I actually traded a green marble, not a blue one,” and change the record. The record of the blue marble being traded for the red marble is permanent and unchangeable – it’s immutable.
This is a key feature of blockchain technology (and our marble game) because it helps ensure that all transactions are transparent and permanently recorded, which helps build trust among participants.
Layer 2 Solutions: Layer 2 solutions are like new rules or tools in our marble trading game designed to make things faster and more efficient without changing the basic rules of the game.
Let’s say that adding trades to the binder (the blockchain) is getting slow because of the increasing number of trades and the complexity of the puzzle needed to add a new page to the binder. Your friends are getting frustrated because their trades are taking too long to be confirmed.
So, you come up with a new system: instead of writing every single trade in the binder immediately, you and your friends decide to trade marbles freely among yourselves during the day and only write down the final state of everyone’s marbles at the end of the day in the binder.
For example, if you and your friend trade back and forth several times during the day, instead of recording each trade in the binder, you just record who ends up with which marbles at the end of the day. This way, you’re still keeping track of who owns what, but you’re not clogging up the binder with every single trade.
This new system is like a Layer 2 solution in blockchain. It handles a lot of transactions off the main blockchain (the binder) and only interacts with the main blockchain when it needs to finalize the end state. It helps speed up transactions and reduce fees without needing to change the basic rules of how the blockchain works.
Conclusion
Ok, no more marble talk ( promise). As mentioned, this is a fairly straightforward overview of the basic principles of blockchain technology and its associated behaviors. This foundational knowledge will not only equip you with a solid understanding of the current dynamics but also enable you to grasp new technologies as they emerge in the field. For instance, with your newfound comprehension of Layer 2 solutions, you’ll be able to assess different approaches that companies propose, enabling you to evaluate its potential and perhaps even fit it into the marble analogy yourself. Oops.