Ever wondered how blockchain mining works, or how transactions are confirmed and added to the blockchain? And me too. But due to the fact that I never came across a clear and accessible step-by-step explanation of this process, I decided to write it myself. So, I present to you the result of my research on how transactions are processed in the blockchain. And in just seven steps.
Step 1: The user, intending to send someone else a certain amount in cryptocurrency or a token, confirms the transaction in his wallet application.
Step 2: The transaction is then broadcast by the wallet application to the corresponding blockchain network. There it gets into the “pool of unconfirmed transactions”, where it will remain until some miner (the one who is engaged in mining) picks it up. Such a pool is a collection of unconfirmed transactions waiting to be processed. More often than not, unconfirmed transactions are collected not in one giant pool, but in small, separated local pools.
Step 3: Miners on the network (sometimes called nodes or nodes, but this is not exactly the same as miners!) Select transactions from pools and collect a new “block” from them. A block, in fact, is a set of transactions (at this point in time, still unconfirmed transactions), plus additional metadata. Each miner collects his own block of transactions. The same transactions can be added by different miners to their blocks.
Example: Consider two miners, miner A and miner B. Both of these miners may decide to include some transaction X in their blocks. Each blockchain has its own limits on the maximum block size. In the Bitcoin blockchain, the maximum block size is 1 megabyte (MB) of data. Before adding a transaction to a block, the miner needs to check if the transaction meets the execution requirements, in accordance with the history of transactions in the blockchain. If there are enough funds on the sender’s wallet balance according to the existing blockchain transaction history, the transaction is considered valid and can be added to the block. If the Bitcoin owner wants to speed up the processing of their transaction, they can offer a higher mining reward. In this case, as a rule, miners will assign a higher priority to this transaction compared to others, due to the possibility of receiving a higher reward for the mining process.
Step 4: By selecting transactions and adding them to their block, miners thereby create a block of transactions. In order for the block to be subsequently added to the blockchain (which means that all nodes in the blockchain will register transactions in this block), the block first of all needs a signature, also called “proof of work” (English Proof-of -work or PoW). This signature is created by solving a very complex mathematical problem that is unique to each block of transactions. Different blocks correspond to different mathematical problems, so each miner will work on solving his own problem, which is unique for the block he has formed. All tasks are equally difficult to solve. When solving such a mathematical problem, large computing power is expended (and, accordingly, a large amount of electricity). You can compare this with performing calculations on a calculator, only in this case everything is much more complicated and is done on a personal computer. This process is called mining. If you want to know in more detail about what kind of math problems you have to solve in the process (in fact, it is not that difficult), then please continue reading. Otherwise, if you need a lighter material, go straight to Step 5.