What is Bitcoin Mining?
Mining, extraction or creation of bitcoins is the reward received for the generation of new blocks for the Bitcoin (BTC) network, by analogy with the extraction of gold. The construction of the blockchain is done through this activity, which allows maintaining a peer-to-peer (one-to-one) network based on up-to-date and secure blockchain technology.
Cryptographic hash functions:
Usually referred to as hashing, it is a mathematical algorithm that transforms any arbitrary block of data into a new series of characters with a fixed length.
On the ToolsOnline site, we can determine the hash of two blocks of data:
Data: La vida es bella
Hash: 81cb54948c8b40aa94923b4088f25d917f7e3c7bc1723aabb2d00b03854d3bb9Data: La vida es Bella
Hash: d64f1585d338c9f04056cf2d6cd49d9fac2bd4aaed661e15b8e4e67bd385acab
The difference is one letter between both blocks of data (b for bella), but the hash changes completely.
What are the transactions and blocks of a blockchain?
Transactions: They are understood as the sending of bitcoins from one person to another using the Bitcoin network, thanks to them we can send and receive the cryptocurrency.
All the data of a transaction, both sending and receiving, are expressed with a code, called Hash, which certifies that the transaction is in progress or has been carried out. The Hash code is a unique and unrepeatable identifier. Let us see the transaction with the hash:
167f4ca61f79ee8c396c118e52ffebad737dcf91ba08616d75508e0094bfbaf7
This transaction has two sending accounts and two receiving accounts that receive the BTC.
There is other data such as amount sent and received by each account, in BTC and in USD.
The chain blocks:
Approximately every 10 minutes the Bitcoin network generates a block, which contains the transactions of that time interval.
Thus, the above transaction was included in block number: 733,212 dated April 23, 2022. (See the block on Blockchair.com)
This block contains 1,929 transactions and therefore 1,929 transaction hashes.
This block 733,212 is identified with its own hash: 0000000000000000000613bedd86caff0f762a8af23ec7fbd408993998576a68
The proof of work and the hash that identifies the block.
Applying the mathematical hash function to transaction hashes along with other block data generates the right-hand side of the hash:
The second part of the block hash consists of the leading zeros, which in this example are 19 zeros:
To obtain these nineteen zeros, the miner must find a unique random number (Nounce), using another mathematical algorithm called proof of work (PoW).
PoW on the block:
The global bitcoin network is made up of thousands of computers called nodes, which in those 10 minutes have processed the 1,929 transactions of this block.
One of the nodes must earn the bitcoin reward.
An amount of bitcoin is created and delivered to the winner through a mining or Coinbase transaction.
It is the first transaction that appears in the block from top to bottom.
In this block the resulting Nounce is 996,687,889.
Concluding remarks:
The work effort of the computer involves an expenditure of electrical energy, which the owner of the node pays for in his electrical consumption, with the bitcoins earned in the reward.
As the nodes are in more than a hundred countries, most of the electricity consumed is generated from renewable sources (hydroelectric, solar, wind) and polluting sources (coal and oil).
So, the pollution problem is not mining itself, but the way electricity is produced in your country, because every day we use appliances such as washing machines, stoves, and televisions, which consume electricity and also pollute.