Say John buys a lemonade from Sandy’s lemonade stand. On John’s copy of the blockchain, he marks that transaction down: “John bought Lemonade from Sandy, $2.” His copy gets spread around town to all the lemonade stands and lemonade buyers, who add this transaction to their own copies. By the time John has finished drinking that lemonade, everyone’s blockchain ledger shows that he bought his lemonade from Sandy for $2.
The reward is agreed-upon by everyone in the network but is generally 12.5 bitcoins as well as the fees paid by users sending transactions. To prevent inflation and to keep the system manageable, there can be no more than a fixed total number of 21 million bitcoins (or BTCs) in circulation by the year 2040, so the “puzzle” gets increasingly harder to solve.
What miners are doing with those huge computers and dozens of cooling fans is guessing at the target hash. Miners make these guesses by randomly generating as many "nonces" as possible, as fast as possible. A nonce is short for "number only used once," and the nonce is the key to generating these 64-bit hexadecimal numbers I keep talking about. In Bitcoin mining, a nonce is 32 bits in size--much smaller than the hash, which is 256 bits. The first miner whose nonce generates a hash that is less than or equal to the target hash is awarded credit for completing that block, and is awarded the spoils of 12.5 BTC.
Nakamoto is estimated to have mined one million bitcoins[27] before disappearing in 2010, when he handed the network alert key and control of the code repository over to Gavin Andresen. Andresen later became lead developer at the Bitcoin Foundation.[28][29] Andresen then sought to decentralize control. This left opportunity for controversy to develop over the future development path of bitcoin.[30][29]