Cryptocurrency mining is the process in which transactions between users are verified and added to the blockchain public ledger. The mining process is the result of introducing new coins into the circulating supply and is the key element that allows for cryptocurrencies to work as a peer-to-peer decentralized network, without the need for a centralized third-party controlling it.
A miner is a node in the network that collects transactions and organizes them into blocks. Whenever transactions are made, all network nodes receive them and verify their validity. Then, miner nodes gather these transactions from the memory pool and begin assembling them into a block.
So how does cryptocurrency mining work?
The first step of mining a block is to individually hash (which is an algorithm that turns an arbitrarily-large amount of data into a fixed-length hash) each transaction taken from the memory pool, but before starting the process, the miner node adds a transaction where they send themselves the mining reward (block reward).
After every transaction is hashed, the hashes are then organized into something called a Merkle Tree (or a hash tree) – which is formed by organizing the various transaction hashes into pairs and then hashing them. The outputs are then organized into pairs and hashed once again, and the process is repeated until “the top of the tree” is reached.
The root hash along with the hash of the previous block and a random number called nonce (which is a 32-bit field whose value is adjusted by miners so that the hash of the block will be less than or equal to the current target of the network) is then placed into the block’s header.
The block header is then hashed producing an output based on those elements (root hash, previous block’s hash, and nonce) plus a few other parameters. The resulting output is the block hash and will serve as the identifier of the newly generated block.
In order to be considered valid, the output (block hash) must be less than a certain target value that is determined by the protocol. In other words, the block hash must start with a certain number of zeros. The target value, also known as the hashing difficulty, is regularly adjusted by the protocol, ensuring that the rate at which new blocks are created remains constant and proportional to the amount of hashing power devoted to the network.
Therefore, every time new miners join the network and competition increases, the hashing difficulty will raise, preventing the average block time from decreasing. In contrast, if miners decide to leave the network, the hashing difficulty will go down, keeping the block time constant even though there is less computational power dedicated to the network.
Miners keep the network secure
Miners secure the Bitcoin network by making it difficult to attack, alter or stop. The more miners that mine, the more the secure the network. The only way to reverse Bitcoin transactions is to have more than 51% of the network hash power. Distributed hash power spread among many different miners keeps Bitcoin secure and safe.
To successfully attack the Bitcoin network by creating blocks with a falsified transaction record, a dishonest miner would require the majority of mining power so as to maintain the longest chain. This is known as a 51% attack and it allows an attacker to spend the same coins multiple times and to blockade the transactions of other users at will.
In order to do this, an attacker needs to own more mining hardware than all other honest miners. This imposes a high monetary cost on any such attack. At this stage of Bitcoin’s development, it’s unlikely that such an attack will occur as it’s unclear what benefit a bad actor would gain from degrading or destroying Bitcoin.
The network has been designed to be protected by the work that cryptocurrency miners conduct and therefore given the opportunity of receiving a reward for mining the block.
While the block reward is granted to the miner who discovers the valid hash first, the probability of finding the hash is equal to the portion of the total mining power on the network. Miners with a small percentage of the mining power stand a very small chance of discovering the next block on their own.
What is a mining pool?
Mining pools are created to solve this problem. It means pooling of resources by miners, who share their processing power over a network, to split the reward equally among everyone in the pool, according to the amount of work they contribute to the probability of finding a block.
Poolin.com allows you to connect with other miners who more or less can share their knowledge about the mining process. Memberships also provide you the chance to seek new opportunities by connecting with members in the Poolin community.
At its core, mining is the process by which computational power (hash power) is used in an attempt to unlock a block in a blockchain. Each block unlocked provides a reward. The more attempts (hashes) you can perform per second, the higher the probability that you will obtain the reward. Because miners by themselves typically don’t have enough hashing power to frequently find blocks, they join a pool that combines the hash power of multiple miners to hash blocks.
With greater collective hashing power, it is easier to find blocks with decreased variance. The reward is split among the miners relative to the proportion of hash power that they contributed to the pool.