"coins" don't actually exist. That's just an abstraction that we humans use to make it easier to talk about the exchange of control over value.
This is the same as most currency, which doesn't exist, there is not enough minted currency to cover bank balances
Transactions consist of inputs (which provide value to the transaction) and outputs (which assign control over value).
The sum of the value of all the outputs is not allowed to exceed the sum of the value of all the inputs. If it does, it is an invalid transaction and will be rejected by all miners and all nodes on the network. If the sum of the value of all the outputs is LESS than the sum of the value of all the inputs, then the excess value is available for the miner (or mining pool) to pay to themselves as a transaction fee.
Every block has 1 special transaction that is allowed to break those rules. This is often called the "coinbase" transaction or the "generation" transaction. The block is allowed (and required) to have exactly 1 of these transactions. This transaction has NO inputs. The sum of the outputs of this transaction is not allowed to exceed the current block subsidy (which is how new value is added to the blockchain) plus the sum of all the transaction fees of all the transactions included in the block. If this transaction tries to include more value in its outputs than it is allowed to, then the block will be rejected by ALL miners and ALL nodes on the system.
In this way, it is impossible for there to be more bitcoins than the protocol allows.
However, the blockchain does not "BALANCE". While there are restrictions that prevent excess outputs to be created, there are no restrictions that prevent a miner or mining pool from paying themselves too little value in the outputs of their "generation" transaction. While it would be pretty dumb for a miner to intentionally pay himself less than he is allowed to, this has accidentally happened more than once in the history of bitcoin. When this happens, the excess value that was provided to the block, but which was not claimed by the miner simply ceases to exist. There is no way to re-create it, and no way to get it back. The value is effectively destroyed. Therefore, there will never be 21,000,000 bitcoins.
Thanks for the detailed explanation so each block created currently increases the ledger by a maximum of 12.5
BTC.
Shouldn't there be a mechanism to reclaim the accidental loss in a block chain and have that available for miners?
Has anyone tried to total the number of
BTC in ledger?