Bitcoin and cryptocurrency mining explained.
The Byzantine Generals problem was first introduced in a computer science article published in 1982
The problem discussed in the article is that reliable computer systems must be able to function effectively in the presence of faulty components that can send conflicting information to different parts of the system.
it is even more acute when we talk about decentralized computer networks. Imagine the following thought experiment: the Byzantine army has surrounded an enemy city.
The army is organized into several units. Each unit is led by a general and everyone needs to come up with a coordinated plan of action. However, they are located far from each other and the only means of communicating with each other is through messages.
To complicate matters, one or more of the generals are possibly traitors. The presence of disloyal generals means that misleading messages could be sent with the aim of disrupting any situation. the coordinated action plan, be it attack or withdrawal.
To find a successful solution to this drum, the Byzantine army needs to find its way to coordinated action, one way or another. To achieve this, the Byzantine army needs an algorithm that works effectively towards a coordinated outcome where loyal generals follow and traitors do not. Now that you are familiar with the problem, let's look at your solution.
It's called the Byzantine fault tolerance algorithm. Over the years, various theoretical solutions have been proposed involving game theory and mathematics. The first practical implementation of the Byzantine fault tolerance algorithm came with Bitcoin. Work test. In this case, the "generals" are nodes of the Bitcoin network, also known as "miners". A network node is a connection point that can receive, create, store, and send data over a network. In other words, nodes are the connection points that make up a network.
For simplicity, think of it like this: In the image, we traditionally use to represent a blockchain, each computer is a separate node. They are all connected and can receive, create, store and send data to each other.
In the context of the Byzantine fault tolerance algorithm, the important concept to understand is that these mining nodes start from the assumption that no one else on the network can be trusted. consensus even in the presence of unsupported nodes. That is, even if there are some Byzantine generals who are not acting in the best interest of the army, coordinated action can still be achieved.
Let's see how this mechanism works in Bitcoin. As we all know by now, Bitcoin is a peer-to-peer network where all activities are carried out by its users through the appropriate software and hardware. These activities include conducting transactions, receiving transactions, and verifying and transmitting transactions. Now, this is where we should introduce the concept of "mining", which many of you have probably heard. Mining is an activity, performed by network participants, that involves Proof of Work and results in the generation of new coins like a reward for the miner who successfully performed this Proof of Work for each new block.
Proof of work requires a lot of calculations performed by a computer aimed at solving cryptographic puzzles. Continue exchanging transaction messages with other network participants. Let's dig deeper into the nuts and bolts of this mechanism to find out how it works. First, let's see how miners create new blocks. Mining nodes collect and aggregate new transaction data. Upon receiving such data, each node independently verifies each and every one of transactions according to a long list of criteria including - source tracking e of digital money that is being spent; - double spending check of the same money; - check if the total volume of transactions is within the allowed range of 0 to 21 million bitcoins (since 21 million is the maximum total supply of bitcoins allowed by the system); And the list goes on: the Bitcoin software installed on the node performs a number of other checks and balances, verified transactions are aggregated into groups of transactions, also called memory pools or memory pools.
When miners compete with each other to be the first to create a new valid block, they must ensure that the transactions in their mem pools have not been included in previous blocks. transactions in a candidate block, the miner needs to construct the block header, which includes some important components: - a summary of all transaction data in the candidate block; - a link to the previous block in the chain, also known as the parent block; - a timestamp showing the block creation time; and a valid proof of work. Summaries of what is included in a given block are done through hash functions, which process the data in such a way as to result in a standardized unique identification code.
This identification code is also known as a fingerprint. The system has a unique identifier for each block of transactions. Here are some examples of block headers as seen on blockexplorer.com and blockchain.info: As you can see at the top, just below the block number, there is a long alphanumeric string called BlockHash or just Hash. Alphanumeric means that it consists of letters and numbers.
This is an encoding data type and is the result of the processing of the block header data below via Bitcoin's cryptographic hash function. You may have heard the name of this function: SHA 256, which stands for Secure HashAlgorithm. You probably remember that we briefly mentioned and explained hashing functions in the section on cryptography. We are discussing them again here because As we have learned, a hash function can decompose any type of data, of any size, into a fixed-length string of characters, which can serve as a fingerprint or unique identifier. These cryptographic hash functions work only in one direction.
Once we have the output, we can't just invert the function, connect the output, and get the input data at the other end. To illustrate what it means to invert a function, consider the four basic mathematical operations: - addition and subtraction are inverse functions of each other - multiplication and division are inverse functions of each other We can always construct equations with these functions to find any unknown variables. For example: 3 * X = 15; X = 15/3 = 5 Many mathematical functions can be reversed in a similar way; however, this is not the case for cryptographic hash functions.
The only feasible way to find an unknown random variable in the input data set of a cryptographic function is to try different values for the unknown, one by one, given all other known parameters, in order to This is basically an approach to brute force consisting of potentially testing all possible combinations. And this is precisely the "work" element as used in Proof of work. The work comprises all the iterative calculations a computer needs to find a solution to the cryptographic puzzle.