So where do bitcoins come from? If you’ve been paying attention, you have probably heard that people can “mine” for bitcoins… almost as if you were deep in a mine covered in dirt searching for gold. Most people just stop there, but if you dug a bit deeper, someone may have said that “mining” is about solving a math problem. And then you would stop, because doing complex math sounds painful, and do you really want to subject yourself to this level of brain trauma
Let me see if I can break this down to something a little more tangible.
First, the truth is that there is no physical labor involved in mining for bitcoins, and it really is about getting the answer to a math problem using computing power (which is where the labor sits).
The way that bitcoin transactions work at a high level is the following.
- You have bitcoins (BTC) to spend.
- You send your bitcoins to someone (there’s a bunch of technical stuff I’m skipping here to focus on the mining part)
- All of the transactions that occur (including yours) within a period of about ten minutes are grouped together (this is called a “block”).
- All of the blocks of transactions that happened before your block of transactions are called a “blockchain”. This new block of transactions will add to that blockchain.
- The only way that this blockchain can be extended is by making sure that all of the new transactions are valid and then by solving this crazy math problem through a bunch of guesses. When someone guesses the right answer, they get some bitcoins for doing this “work” (right now the reward is 25 BTC).
- Until all of these steps happen, you haven’t completed a transaction, and the point of all of this is to verify transactions in a decentralized way.
Let me stop there, and talk about this crazy math problem for a second.
Bitcoin uses something called a hash function to turn a bunch of text into a fixed length gobbledygook string of numbers and letters using complex algorithms. If you want to see what the hell I’m talking about, you can throw some text into a hash generator and see what comes out of the other side. Don’t worry about what comes out, just know that it’s a unique number and it’s always the same length.
- The Bitcoin network sets a target result (T) that people should try to arrive at using the hash of the previous block (A) + the transactions in the current block (B) + a random number – also called a nonce (N).
- The goal is for the stuff that comes after you hash all of A + B + N together to be T or lower than T, so the formula would read as follows: Hash of (A + B + N) <= T.
- Since you know most of the stuff already (A, B, and T), the math problem is just about figuring out what N can be. It’s freakin’ hard to say the least, and it’s about banging your head on the wall until you randomly hit the right number.
- For finding the right number, you get a reward of 25 bitcoins. Yeah!
By the way, this reward for figuring out the right answer is cut in half every 210,000 blocks, so it used to be 50 BTC and it will be 12.5 BTC once we get to 420,000 blocks. We’re around 238,000 blocks in the blockchain right now, so you may want to get cracking.
But before you run to dust off your spare laptop to start making some cash, you should know that bitcoin mining is no longer something that a single person with a laptop can do. The Bitcoin network is trying to maintain about a 10 minutes buffer between the confirmation of blocks, and to do this, they make the target harder and harder to get. It’s now to the point that it takes really powerful sets of computers to mine for bitcoin.
Hope that helps, and if you have happen to know of way to simplify this even more, I would love to hear about it.
Here are two videos that I have found to be helpful in understanding the process a little more:
What is Bitcoin Mining? – A high level overview
How Bitcoin Works Under The Hood - Digging deeper into the details