How does Bitcoin Mining Work?

Governments have the ability to print more money when they need to when it comes to traditional fiat money. To accumulate bitcoin, computers, no matter where they are on the globe, compete with each other ‘mining’ for coins. Bitcoin is not something curated on demand, but instead, discovered.

How does mining take place?

The bitcoin network manages the organization of who paid what in transactions by collecting all of the transactions made during a set period into a list, called a block.The miners’ then confirm those transactions and write them into a general ledger.

Making a hash of it

A ‘blockchain’ is a general ledger composed of a long list of blocks. It can be used to identify connections and trends existing for any transactions made between any bitcoin addresses, at any point on the network. Whenever a new block of transactions is created, it is added to the blockchain. It records a list of all the transactions that ever took place on the bitcoin network. A constantly updated copy of the block is given to everyone who participates.

The miners have the job of ensuring that all of this digitally held information is intact and is not tampered with, so that the general ledger can be trusted by all of its users.

Miners process every block of transactions created. They apply a mathematical formula to the data in the block, turning it into a ‘hash’’. The hash created is a shorter, seemingly random sequence of letters and numbers. This has is stored at the end of the blockchain along with the block.

A hash is designed to be easily created from a collection of data like a bitcoin block using a mathematical formula, but to be nearly impossible to apply any formula to when trying to ‘reveal’ what the original data was. Another security benefit of a hash is that each one produced is unique, regardless of the amount of data being manipulated by the formula. If even one variable in a bitcoin clock is changed, its hash will change completely.

Hash is created from data in the block beyond just the transactions. One of these other pieces of data included in the new hash creation is the hash of the last block stored in the blockchain.

Because each block’s hash is produced using the hash of the block before it, it confirms that that block – and every block after it – is legitimate. If it was tampered with, it would be obvious because the data would no longer sensible fit in increasingly long and connected sequence.

If you inauthentically made a change to a block that had already been stored in the blockchain, that block’s hash would change. When a hashing function is run to check that block’s authenticity, it would be discovered that the hash was different from the one already stored along with that block in the blockchain. That is instant proof of tampering.

Additionally, tampering with a block would also make the subsequent block’s hash wrong too, because each block’s hash is used to help produce the hash of the next block in the chain. Because each block uses data from the previous and contribute data to the next, everything would be affected all the way down the line.

Competing for coins

Miners compete with each other to ‘seal-off’ a block, using software written specifically to mine blocks. Every time someone successfully creates a hash, they get a reward of 25 bitcoins, the blockchain is updated, and the information is provided to everyone on the network. Mining must happen consistently, to keep the transactions working.

It’s very easy to produce a hash from a collection of data, so the bitcoin network has to make it more difficult. If it were not made more difficult, hundreds of transaction blocks could be hashed each second, and all of the bitcoins would be mined in minutes. The bitcoin protocol deliberately makes it more difficult, by introducing something called ‘proof of work’.

The bitcoin protocol has specific requirements for an acceptable hash. The block’s hash must have a certain number of zeroes at the start. This can be difficult because there’s no way of telling what a hash is going to look like before you produce it, and when any new data is added to it, the hash will be totally different.

Miners cannot change any transaction data in a block, but they must switch-up the data they’re using to create a different hash. To do this, they use a random piece of data called a ‘nonce’. It is paired with the untouched transactional data to create a hash. If the hash doesn’t fit the required format, the nonce is changed, and the hash is reattempted. The fact that all the miners in the network are trying to do it at the same time, and that it often takes several attempts, is what makes it difficult, making the miners really earn their bitcoins.

Leave a Reply

Your email address will not be published. Required fields are marked *