How does bitcoin extraction work?
In traditional monetary systems, governments simply print more money when they need it. But in bitcoin, money is not printed at all - it's discovered. Computers around the world "mine" for bitcoin by competing with each other.
How is the mining going?
People send bitcoins to each other via the bitcoin network all the time, but unless someone keeps a record of all these transactions, no one would know who paid what. The bitcoin network deals with this by collecting all the transactions made during a given period in a list, called block. Minors are responsible for confirming these transactions and keeping them in a large register.
We make a hash
This big register is a long list of blocks, known as "blockchain". It can be used to explore any transaction between bitcoin addresses at any point in the network. Whenever a new transaction block is created, it is added to the blockchain, creating an even longer list of all transactions that have occurred on the bitcoin network. A constantly updated copy of the block is given to all participants so that they know what is going on.
But you have to trust a general register, and all that is numerical. How to make sure that the chain stays intact and is never tampered with? This is where the miners come in.
When a block of transactions is created, the miners submit it to a process. They take the information in the block, and apply a mathematical formula to it, turning it into something else. This something else is a much shorter, seemingly random sequence of letters and numbers known as a hash. This hash is stored together with the block at the end of the blockchain at that time.
Hashes have interesting properties. It's easy to generate a hash from a data collection like a bitcoin block, but it's virtually impossible to determine what the data was just by looking at the hash. And while it's very easy to produce a hash from a large amount of data, each hash is unique. If you only edit a single character in a bitcoin block, its hash will change completely.
Miners do not just use transactions in a block to generate a hash. Other data is also used. One of these data is the hash of the last block stored in the blockchain.
As the hash of each block is produced using the hash of the block before it, it becomes a digital version of a wax seal. He confirms that this block - and all the blocks that follow - is legitimate because if you tampered with it, everyone would know it.
If you try to simulate a transaction by changing a block that has already been stored in the blockchain, the hash of that block will change. If someone checked the authenticity of the block by running the hash function on it, it would discover that the hash was different from the one already stored with that block in the blockchain. The block would instantly be spotted as a fake.
Since the hash of each block is used to help produce the hash of the next block in the chain, altering a block would also make the hash of the next block erroneous. This would continue to the end of the chain, throwing everything in the trash.
Competition to win corners
That's how the miners "seal" a block. They are all competing with each other for this purpose, using software written specifically to mine blocks. Whenever someone manages to create a hash, he receives a reward of 25 bitcoins, the blocking chain is updated and everyone on the network hears about it. This is the incentive to continue mining and to make transactions work.
The problem is that it's very easy to generate a hash from a collection of data. Computers are really good for that. The bitcoin network must make it more difficult, otherwise, everyone would have hundreds of transaction blocks every second, and all bitcoins would be extracted in minutes. The bitcoin protocol makes it deliberately more difficult, by introducing what is called a "proof of work".
The bitcoin protocol will not accept any old hash. It requires that the hash of a block has a certain appearance; it must have a certain number of zeros at the beginning. There is no way of knowing what a hash will look like before you produce it, and as soon as you add a new piece of data to the mix, the hash will be totally different.
Miners are not supposed to interfere in the transactional data of a block, but they have to change the data they use to create a different hash. They do it using another random data called "nuncio". This is used with the transaction data to create a hash. If the hash does not match the required format, the nuncio is changed and the whole is chopped again. It may take many attempts to find a nuncio that works, and all the miners in the network try to do it at the same time. That's how miners earn their money.