Mining creates new blocks and then adds them to the blockchain. New blocks issue new Bitcoins and at the same time confirm some of the new or still open transactions.
Until November 2012, 50 Bitcoins were paid out with each new block, until July 2016 25, until May 2020 12.5 and since then 6.25.
In this way, decentralized money creation takes place. The process is very computationally intensive, and in return, the participant who creates a valid block receives the created Bitcoins and the fees from the included transactions as a reward.
After a new valid block is found, like unconfirmed transactions, it is disseminated via flooding algorithm to all Bitcoin nodes in the network as a new longer valid blockchain.
Mining in the Bitcoin system in this way also solves the problem of the Byzantine generals: since there is no central authority that authenticates the participants, the Bitcoin nodes do not trust each other on principle. The problem for each Bitcoin node is to find out which blocks or which blockchain is the "correct" one, i.e. the one trusted by the majority. Valid blocks are only created through computationally intensive mining. Thus, every Bitcoin node trusts the longest valid blockchain, since it has the most computing power and is therefore assumed to have the majority of participants.
Proof of work for Bitcoin consists of finding a hash value that is below a certain threshold. The threshold value is inversely proportional to the mining difficulty. The threshold value can be used to regulate the effort required to solve the proof of work, because the lower this value is, the less likely it is to find a matching hash. The hash is calculated by applying the SHA-256 cryptological hash function twice to the initial area of a block (block header).
The procedure works as follows:
Initialize block, calculate root hash of block from transactions.
Calculate hash value: h = SHA256(SHA256(block header))
If h >= threshold, modify block header and return to step 2.
Else (h < threshold): Valid block found, stop calculation and publish block.
To ensure that a hash value can be found below the specified threshold, there are several fields in the block header whose value can be changed. The Nonce field exists specifically for this purpose.
Forks (or chain splits) are also events where a blockchain splits and both inventory ledgers continue independently. This usually occurs when a protocol change is not universally supported, but continues nonetheless. By splitting the blockchain into two separate histories, a Bitcoin can also be used in both payment systems after a chain split. Thus, each owner of a Bitcoin received one Bitcoin Cash at the time of the Bitcoin Cash fork. When making a transaction after a chain split, however, it is necessary to check whether there is protection against replay attacks.
Known chain splits of Bitcoin are:
Bitcoin Cash: split at block 478558.
Bitcoin Gold: split at block 491407
Bitcoin SV: Split at block 556766 of Bitcoin Cash.