What is Blockchain, and what is Block? Explained in a simple and understanding way.
What is a block?
In terms of cryptocurrency, a block is just a bunch of data. The data could be almost anything, but it’s just a collection of records. For crypto, bitcoin, this data is just a list of transactions. For example, it might look like this:
X pays Y $50
A pays U $80
Y pays H $15
If we’re dealing with ethereum, it’s primarily transactions, but it can be a few other things, like smart contracts, which are best, but we would see it in the following article. For other alt-coins, they can be the usage of your wifi, or files, or documents. Nonetheless, a block is just a collection of records.
For this example, to explain what a blockchain is, we will stick with a record of transactions, like in bitcoin. Specifically, we call this a ledger because it’s a record of value exchanging hands.
These blocks have limits, and they can only have so many transactions, so we have to keep adding them. For our example, bitcoin has an average of around 1500 transactions right now. This number changes, but you don’t need to know why. Just know that these blocks fill up, and then we have to do something with them.
What do we do with these blocks once they are full? We add them to the network. How do we do that? We mine them, and since Bitcoin is a “Proof-of-work” model, we have to prove that we mined them. This brings us to something called a hash.
What is a hashing function?
A hashing function is a system where you can put something into it and output a hash. There’s a ton of math happening inside this “magical black box,” but essentially, you give it something, and it gives you something. In this case, bitcoin uses the SHA-256 hashing function. SHA stands for “Secure Hashing Algorithm,” and 256 refers to the amount of 0 and 1s it has in whatever it puts out. So whether you put it your name or the entire dictionary, it’ll always be 256 1s and 0s. Our computers are intelligent, and so they convert those 0 and 1s to letters and numbers. It’s complicated, but essentially you need to know three main things about a hashing function.
Mainly that you can’t just find it… you HAVE to guess and check.
Also, that changing the input just a tiny bit changes the output a lot.
And lastly, calculating the hash takes some time. It might only take milliseconds for one tiny string of text, but if you have an entire book and you want to check a few million variations of it, it starts to rack uptime.
And so what bitcoin is doing, when you mine it, is we are trying to add random numbers to whatever the block is to get a special ending. Essentially, bitcoin is looking for a lot of zeros, and computers and mining farms all around the world are all “mining” away to find the right number. When they do, we say that the block is “solved” and “verified.” But we will get to that in a little bit.
Something important about any blockchain is that it is also decentralized. This doesn’t have to be confusing, so think about it like this. Centralized means one person controls it. For example, your grades in high school… only your teacher had access to add in your grades and change it. They could flunk you if they didn’t like you, and nothing personal here, but maybe you just didn’t understand what they were teaching. They were terrible at teaching. Anyways, decentralized means more than one person can have access to your grades.
Imagine if all of your classmates were allowed to look at your answers and give you a grade based on your papers and tests. Imagine if they could vote on what grade you got instead of your teacher. This is essentially what decentralized means. Instead of one person having a list of all the bitcoin transactions literally, anyone who wants to have them can have them and look at them. Not only that, and this is the crucial part, but anyone can mine and vote on the blockchain. This means they can say, “Bill did pay John $50”. Or, they could make fake transactions and say, “John paid Bill all of his money.” That problem is solved by using cryptocurrency wallets.
But that begs the question, why would a group of teenagers want to look at your papers and tests? Even more so, why would they want to spend a lot of time looking at them and then grade them? Well, in this analogy, they would be paid to — in almost every blockchain, you get a reward for participating and putting in good votes. In bitcoin, you get paid in bitcoin and so on.
So far, we’ve been over what a block is, what a hashing function is, and what decentralized means, so if you’re still with us, let’s learn why it’s called a blockCHAIN.
So with bitcoin, there are two extra things you need to know about.
Whoever solves the block and finds the magical hash, add “[my account] received two bitcoins for mining” at the top of the block. This is their mining reward. This is how more bitcoins are created.
Second, they also add the hash of the last block to it.
This makes it a chain since each block refers to the last one. This is where the magic of the blockchain works. If you try to go back and edit an old block, the newer ones all changed because you messed up the hash that all of those pointed to. Remember when we talked about the hashing function and SHA-256? Changing it just a bit changes the whole thing? That’s how we can make sure someone doesn’t go back and add more money to their account. So in a sense, whatever gets added to the blockchain is written down in history forever because it can’t be changed. This is good for things like transactions but bad for things like copyrighted material or embarrassing things.
So, in conclusion, we have blocks that consist of data, and in the case of cryptocurrencies, it’s usually a list of transactions.
Next, after we have a block, we have to find the “password” to it or the hash that solves the block. Miners do this by guessing and checking until they hit the jackpot.
After they find the solution to the block, they make sure that it’s linked to the last block, so each block has the history of every transaction on it.
Since each block is connected to the last block — it makes a chain. That’s a blockchain.