A DETAILED GUIDE TO HOW CRYPTOCURRENCY MINING WORKS
What is mining
How it works
Understanding hashing and blocks
Understanding the Merkle tree and how it works
How to mine on solana
This is one of the key elements that allows cryptocurrencies to function as a decentralized peer to peer network without the need for a third-party central authority.
It is a process in which transactions between users are verified and added to the blockchain’s public ledger. and also the process used to introduce new coins into the existing circulating supply.
How does it work?
A miner is a node in the network that collects transactions and organizes them into blocks, whenever transactions are made, the miner node receives and verifies the actions and adds them into the memory pool and starts assembling them into a multi-transaction block.
The first step in a block mining process is to hash each transaction into a “memory pool”, and this transaction is referred to as a coinbase transaction, it is a transaction where the coin is created and in most cases, it is the first transaction in a new block.
Once all the transactions are hashed, those hashes are then organized into something called a “merkle tree” or “hash tree”, meaning the hashes organize themselves into pairs and then hashed again until the top of the tree is reached, also called “Root Hash” or “Merkle’s Root”.
The Root hash with the hash of the previous block and the random number called “Nonce” is then placed in the block header.
The block header is a hash producing an output which will serve as a block id and this block id must be less than a certain target.
In other words, “Block header Hash” must start with a number of zeros, this target value also known as “hash difficulty” scales and ensure that the rates at which new blocks are created remain proportional to the amount of hash power in the network.
Miners keep hashing the header over and over through the nonce, until a miner in the network finally produces a valid hash. And when a valid hash is found, the founding node will broadcast the blocks to the network, the other nodes will check if the hash is valid and the other nodes in their copy of the blockchain, then move on to mining the next block.
However it sometimes happens that Two miners broadcast valid blocks at the same time and the network sub-with two concurrent blocks, Miners start mining the next block based on the block they received first.
The competition between these blocks will continue until the next block is mine based on one of the competing blocks.
The abandoned Block is called “An Orphan Block or A Stale Block”. miners of this block will return to mining the chain of the winning block. While the reward of the block is to the miner who discovered the valid hash first, the probability of finding the hash is equal to the proportion of the total mining power on the network. Miners with the small % mining power have a very small chance of discovering the next block on their own.
A mining pool is created to solve such problems, it means pooling free sources by miners who share their network’s processing power to distribute the rewards equally among all members of the pool according to the miner’s work that they contribute to the probability of finding a block.
Mining is a process of creating a new block for a blockchain and filling that block with transactions.
Let’s see how mine bitcoin is, groups of transactions are grouped into blocks that form the bitcoin Blockchain. and these blocks use a hash function, which gives each block a very long unique number and this job is done by the miners on the bitcoin network and it is also their job to process the blocks and add them to the chain.
In order to link two blocks together, the most recent block in the chain must contain its own unique hash number and the hash number of the previous block. This correspondence allows them to bond. Thus, only by knowing this previous number can a miner add a new block to the chain there.
What is the merkle tree?
Regarding the blockchain, we have blocks and this block will be connected using the hash value.
Each block will have transactions, it can be thousands of transactions, then we want to find a hash of the block. So should we combine the whole block and find a Hash or find the Hash of each transaction?
Now if you want to find the hash of every transaction you need to store all the hashes so a block doesn’t have a single hash it will have thousands of hashes but we don’t want that. What we want is to get a single hash, and one of the ways to implement this is using Merkle Tree.
How do miners know this previous hash number?
Well, they have to guess it, and to guess that number the miner’s computer has to submit a lot of guesses and that means spending a lot of computing power.
Now all miners on the networks submit these guesses until one of them is right (correct) then they will be allowed to add their blocks to the chain and in return for their efforts they will receive a reward block which is “Fresh and tasty bitcoins”
CLICK and follow the step by step to mine your solana: