What is blockchain
Experts in mathematics, cryptography, and network engineering often explain blockchains in technical jargon. It turns out that blockchains are more straightforward than you think, at least for the most part.
So, in this explanation, we will start with a simple computer concept and move on to the blockchain. If you are already familiar with the concepts of servers, databases, and distributed databases, feel free to skip to the blockchain section.
A blockchain is a form of database, or rather a distributed database.
The data stored in the blockchain is a transaction in cryptocurrency.
Blockchains store data (transactions) in chronological groups known as blocks rather than in folders and tables, as in conventional databases.
The Bitcoin blockchain is open and accessible to everyone, unlike a centralized database managed by a company or government. Unlike databases in which you can add, delete or edit information, you can only add to blockchains.
What is a computer?
A computer is a piece of electronic equipment that can read and manipulate data. Computers come in many forms, including desktops, laptops, tablets, game consoles, and mobile phones.
What is data?
Data is just information, and it can have an infinite number of formats, from videos and photos to text. Previously, we stored such information on physical objects, such as paper or film. With the help of modern computers, we can keep this information digitally.
The combination of components in our computers allows us to quickly and easily access and modify all this data in digital format.
What is a server?
Servers are computers that host websites, files, databases, or other services. When you want to access this website or service, you access the server it resides. For example, when you want to view your Gmail mailbox, you access the Google server that provides Gmail services.
All computers have a so-called IP address (Internet Protocol Address), which is essentially the computer's email address. The website's name is just the code of the server's IP address on which this site is located. When you type Google into the search bar, it takes you to the server or computer where Google is located.
Servers can be configured so that multiple servers have the same IP address, allowing large websites such as Google to distribute traffic between thousands of servers.
What is a database?
The next step to the understanding blockchain is understanding what a database is.
A database is a giant set of information stored on servers that can easily access, manage, and update.
This large set of information or "data" can sometimes require hundreds or thousands of servers running on giant facilities known as server farms (huge buildings with thousands of computers).
Large Internet companies such as Amazon and Google use substantial server farms to store their websites, applications, and user data. As a rule, these databases are managed only by a certain number of approved people, located in one central location. This means that its security depends entirely on the server farm, in which there are no failures, or on the fact that hackers will not compromise servers with access.
Data could be lost if a fire broke out on the farm or a leak in case of hacking. The central location and control points create obvious attack points for hackers. For this reason, some databases are distributed between computers in different physical locations. Such databases are called distributed databases.
What is a distributed database?
Distributed databases are stored on servers separated by a location rather than a single central location for security reasons. In the context of a distributed database, these servers are often referred to as nodes.
Thus, if one place has failed or been hacked, it can be disabled, and other nodes in different locations can continue to work to maintain the database.
Now that you've figured out the above, it should be easier to understand blockchain because blockchain is just a form of distributed database.
What is blockchain?
You can think of blockchain as a version of a database, or more precisely, as a distributed database. The main differences are in the type of data it stores, the way it is stored, who is allowed access, and that the blockchain data cannot be manipulated or deleted.
Note. Blockchains can be "unauthorized" (publicly available to everyone, for example, Bitcoin) or "authorized" (created by a company or group that provides access only to certain people). This article talks about blockchain in Bitcoin, which does not require permission.
What it stores: The Bitcoin blockchain is a type of distributed database that stores Bitcoin transactions.
How it stores: Instead of a regular database where information is stored in arbitrary folders, Bitcoin transactions are stored in "blocks." When new transactions occur, they are grouped into these so-called blocks.
There is only room in these blocks for a certain number of transactions, and when a block is filled, it is tied to the previous block and added to a long chain of transactions (hence the "blockchain").
This creates a chronological transaction history, like a registry, from the first transaction in the first block to the last transaction in the most recent block. The blockchain stores these blocks in a format that allows us to view a perfectly recorded Bitcoin transaction history.
Who is allowed access: like the database, the Bitcoin blockchain needs a set of computers to work. And, like distributed databases, the Bitcoin blockchain is not stored in one central location. Instead, it is dispersed across multiple computers and sites. Thus, many others will keep the data (transaction registry) in an active state if one computer fails.
Governments or companies use computers with typical databases, but Bitcoin relies on ordinary people with personal computers. Those who want to be a node to run the blockchain download Bitcoin's open-source software and all or part of Bitcoin's transaction history.
Transactions cannot be manipulated or deleted.
Another fundamental difference between databases and bitcoin is that, unlike a database where old data can be deleted or modified, bitcoin transactions are irreversible. In this sense, the Bitcoin blockchain is like a database you can only add, and transactions are never changed or deleted.
If blockchain is just a type of database, what is unique about Bitcoin?
Not only that, but how does such a database maintain accurate data?
And how will it stay safe if someone can start a node and participate?
These are all great questions, and this is where Bitcoin gets interesting. Although the basic concept of the Bitcoin blockchain is relatively simple, it has certain features that make it a breakthrough in computer science.
The problem in computer science, known as the Byzantine Generals problem, was never fully solved until Satoshi Nakamoto created Bitcoin. Robert Shostak first discovered and formalized the issue in 1978 during a NASA-sponsored computer science project.
The analogy of the problem described by researchers Leslie Lamport, Robert Shostak, and Marshall Pease in their 1982 paper follows.
"We imagine that several divisions of the Byzantine army have set up camp outside the enemy city, with each division commanded by its general. Generals can only communicate with each other through couriers. After observing the enemy, they must develop a common plan of action. However, some generals may be traitors, trying to prevent loyal generals from agreeing".
So how do the generals ensure that they are all on the same side and that the information received is accurate? The battle may be lost if they all don't work together.
Now imagine this, but these are nodes in the database instead of generals. If some nodes in the database malfunction and start sending incorrect information to others, how does the database form a consensus on the correct data set? For example, suppose some computers say it's 12:30 and others say 00:30. How will these computers determine which group is right?
While a centralized database managed by a government or a company has administrators who can fix such a problem, a distributed database with nodes managed by random people over the Internet, such as blockchain, may not cope.
Satoshi Nakamoto used a consensus mechanism called proof of work to solve this problem.
What is a consensus mechanism?
A consensus mechanism is a system that allows nodes in a distributed computer system (database, blockchain, etc.) to reach a "consensus" on the correct set of data. Simply put, it is a set of rules that allows everyone to agree on what is right and what is wrong.
This ensures the security of blockchain networks and allows participants (nodes) to verify the authenticity of data (transactions) without trusting each other.
Nakamoto used a consensus mechanism called Proof-of-Work (PoW) to solve a Byzantine problem associated with the Bitcoin buzzword "mining."
Proof of Work (PoW)
Simply put, Proof-of-work is a process in which Bitcoin nodes compete for the right to add a new block of transactions to the blockchain. The competition is to solve a complicated puzzle before the other nodes do it.
This puzzle is challenging to solve, but it is easy to check it with the rest of the nodes when it is solved. Thus, the node must provide an answer, also known as a "proof," so that everyone else can quickly verify whether it is true or not.
One of the best analogies used to solve complex puzzle nodes is taken from the book "Digital Gold" by Nathaniel Popper.
"... it's relatively easy to multiply 2903 and 3571 using a piece of paper and a pencil, but it's much, much harder to figure out which two numbers can be multiplied together to get 10,366,613."
By this analogy, the node must determine which two numbers multiplied together will give 10,366,613 by guessing random combinations until the correct result is found. The node then provides the answer (2903 and 3571), or "proof," to other nodes, who can then quickly multiply the numbers and verify their correctness.
Whoever solves the puzzle first translates the transaction block to other nodes. This ensures that only those who have invested enough energy and computing power will have the right to add new transactions to the registry.
When nodes receive a new block, they perform something like previous auditing transactions to ensure that the new trades stack up correctly and that the correct amount of bitcoins is left in the registry.
After all, nodes verify that transactions in the new block make sense compared to previous entries in the registry. The latest block is bound to the last block and permanently stored in the blockchain. The node that solved the riddle is then rewarded with bitcoins.
This process is commonly called "mining" because the computer work required by a node to receive a bitcoin reward can be viewed as the digital equivalent of the material work needed to mine gold.
Since it takes so much computing power to add a new block to the chain, it becomes impossible to add fraudulent transactions, such as adding additional bitcoins to your wallet. If someone wanted to try this, they alone would need to account for more than 50% of all Bitcoin nodes and computing power to add a new block and then force most nodes to accept and validate that block as legitimate.
Given how big the Bitcoin blockchain has become today, the upfront cost of the computer hardware needed for such an attempt, not to mention the electricity costs for all of this, would be virtually impossible for any group or even government.
And even if it were successful, people would have discovered a problem with the system and, consequently, would have sold their assets, devaluing the very currency they were trying to counterfeit.
Thus, the proof-of-work process effectively solves the Byzantine problem since nodes can trust that new transactions (data in the blockchain) are not fraudulent, without the need to trust each other or know each other. And since the bitcoin reward provides an economic incentive to participate rather than attack it, the Bitcoin blockchain will remain Byzantine fault-tolerant as long as people believe Bitcoin has value.
Combining these functions leads to creating an immutable register of economic transactions, which is controlled by a collective of users, not by any company, government, or group.