May 23, 2023

How Does Bitcoin Mining Work

How Does Bitcoin Mining Work

Bitcoin was the first cryptocurrency invented, and it all comes from the idea of decentralization, or a financial system with no central banks or central authority, like governments.

The underlying technology is called Blockchain.

Imagine a chain, with pieces of metal linked together. We’ll call each metal link a block.

A block is simply a record of transactions for a set period of time. A new Bitcoin block is made every ten minutes.

So you have your first block and say I send you 1 Bitcoin. That gets recorded and stored in the block. In the next block you send it back. It records that.

Another way to look at is a ledger, basically a list of all transactions with each block linked to the block before and after it. It’s just a chain of transactions in sequential order.

Mining And Decentralization

In order to have no central authority, these blocks of transactions are checked by computers. Each computer in the network downloads a copy of the ledger, the list of all past transactions, the blockchain.

A mining computer simply validates transactions.

There is a security protocol called SHA-256. It’s a program that creates a string of characters and it’s a “blackbox,” meaning you can’t reverse the logic backwards. You put something in the box and it does something with it and gives you something back. But what’s going on in the box? You’ll never know.

Here, give it a shot on this website.

Put your name in. Delete it and put it in again. You get the same value, but how does it come up with that value? That’s the secret of the box, of SHA-256.

It’s an encryption/cryptography protocol and this is why Bitcoin is called a Cryptocurrency.

On the website I put in “bitcoinfi” and get the value “9b62e4913243e4de622c217be4311483170d4c66b88c8fc42a39d5d8d58656c5”

So the Bitcoin code will give each block a hash value, like the one above.

But what did it put in to get that value? Your guess is as good as mine.

That is what the computers are trying to solve, by putting in random values and generating hashes as shown above.

The difficulty of figuring out the input value is a game of probability and it’s a competition for the computers to see which one inputs the correct value first.

The computer that finds the correct answer gets rewarded Bitcoin. 

This is how people make money mining.

Each Bitcoin block gets validated every 10 minutes on average.

So what if we doubled the amount of computers doing the math?

For a week or two, it would validate blocks at a faster rate, every 5 minutes or so, but then it would dynamically adjust the program to make it twice as difficult, pushing the validation time back up to 10 minutes.

The Bitcoin code has a built difficulty adjustment to keep blocks coming in every 10 minutes on average. The more computers mining, the more difficult it becomes to mine. 

Again, it’s just a game of probability, to see which computer or pool of computers can “guess” the correct input that matches the value generated by the SHA-256 program.

The last Bitcoin will be mined in the year 2140 according to the code. There are only 21 million available and 19 million+ have been mined so far.

Decentralization

Instead of some third party intermediary keeping track of the transactions like banks and financial institutions, Bitcoin uses a large network of computers to validate the ledger.

This makes Bitcoin extremely secure, because to hack the system you would have to hack thousands of computers all over the world on various networks, instead of just one bank or credit union.