block generation explained
As discussed in the hashrate section, recall that the goal of all miners, in contributing their computing power to secure the network's blockchain, is to reap the block reward. The block reward occurs—you guessed it—every time a block is generated. Above, we get a sense of how often this happens across various networks.
Note that the difficulty level from the previous section also comes into play here. The difficulty level will typically adjust after a specified period of time (in Bitcoin's case, every 2,016 blocks or about two weeks), based on the amount of hashing power just provided over the previous difficulty period. This results in a predictable, stable block time, according to the protocol (and this is about every 10 minutes in Bitcoin).
Each time a new block is generated, a few things are happening.
First, know that transactions on the network are constantly being "relayed" to the nodes, as users make them. However, these transactions don't become "confirmed" until a miner picks them up into their newly generated block. Until a transaction is confirmed, then, it sits as pending in a holding area of sorts on the nodes (called the mempool). Miners pick up transactions typically based on how high the transaction fee is, which is set and paid by the user. Yet as we have said, currently the vast majority of the miners' block reward comes not from transaction fees, but from newly generated coins—a process which is baked into each "winning" block that the miner generates.
Therefore, the process of block generation typically goes like this:
Users make transactions which sit pending in the mempool;
Miners begin making the "next" block, putting transactions in them based on their transaction fees;
Miners simultaneously work at tremendous processing speeds to solve math problems or "hashing algorithms" which prove to the nodes that the miners actually did "work" and everything is adding up correctly;
Nodes collectively confirm and "award" that the next block will come from one miner only—this process is in reality based less on skill and more on probability like a lottery;
Blocks from miners that did not "win" thus become pointless, and "orphaned;"
All transactions which are included in the "winning" block thus become "verified" with 1 confirmation from all nodes;
The process repeats and more blocks are generated, constantly building upon themselves to form the "blockchain."
Thus, the longer the chain becomes, the more confirmations there are for transactions in deeper blocks, in turn making the entire chain more "valid" and secure.