how does mining bitcoin work?

135 views

I’ve seen and read online that you get your computer to like solve math problems to “mine” and thus get bitcoin. But how do this even work?!? How does solving a math equation get you a bitcoin and why do you even need to solve math to get the actual bitcoin in the first place? I know I’m not the best phraser but this boggles my mind.

In: 2

Bitcoin is basically just math.

To “mine” bitcoin, you solve very hard mathematical problems–problems that can basically only be done by repeatedly guessing and checking to see if the answer is right. This means that the difficulty of these problems can be adjusted (which happens automatically, it’s baked into the bitcoin network) to decrease the amount of bitcoin being produced over time. It also means that you won’t see some genius come up with an algorithm that lets them mine as much as they want.

If you guess right, you’ve “mined” a block of bitcoin. You then broadcast that to the bitcoin network, and other nodes of the network verify your answer. When the other nodes verify your answer, they recognize that you’ve mined this bitcoin, and thus they will treat you as if you have the bitcoin in your wallet. You can then go and spend it.

But if you lie about it–if you broadcast “I’ve mined X bitcoin, it’s in my wallet now,” but it’s not true–then the other nodes will verify that your answer is incorrect and will treat you as if you *do not* have that bitcoin in your wallet. And when you go to spend it, the node verifying that transaction will say “no, you don’t have that much bitcoin,” and will refuse the transaction.

Bitcoin isn’t a physical thing, it’s literally *all* just math and verification by other nodes of the network. That’s part of why all transactions are visible to the network–every node of the network has the ability to verify that you do have the bitcoin before you spend it.

As for why solving math problems mines bitcoin? That’s just because that’s the mechanism that was chosen to facilitate the creation and spending of bitcoin. It could have been something else, but this way allows all the features required to have what’s known as a “trustless” network. That means that every node of the network has the ability to actually, mathematically *prove* that you have this bitcoin available to spend. They don’t need to trust you when they can figure it out for themselves, and something that is infinitely repeatable and not fakeable (like math) is the best way to do that.