As the title my question is how they earn bitcoin by mining?
Is it only from the block rewards or they also get btc for the validation of transactions?
When a Bitcoin transaction is made, that transaction is stored in the form of a block in the blockchain, and this work is done by Bitcoin miners. Whoever can add as many blocks to the blockchain gets Bitcoin as a reward. And to complete this task, a complex algorithm needs to be solved and a powerful computer device is required.
In addition, when we make a Bitcoin transaction, a transaction fee is deducted for each transaction and Bitcoin miners also receive that fee. However, we know that Bitcoin has a fixed supply, when the entire supply of Bitcoin is mined, what will the miners do? You may have this question. Now miners receive Bitcoin as a reward as well as transaction fees, but when new Bitcoin mining stops, they will receive transaction fees and maybe then the transaction can increase a little from the current time. Because the role of miners for a valid Bitcoin transaction is immense.