- Personal Finance»
- Investing in Stocks, Bonds, Real Estate, More
Understanding the Bitcoin Mining Process
What is a Bitcoin? Where are they coming from? Anybody who wants to get into cryptocurrency mining with their eyes open has probably asked around to know how these currencies are being generated and probably got some vague answer like, “you generate a hash function which has zeroes at the end.”
This probably generated as many questions as the zeros you’re supposedly meant to look for but that ends today. I’m going to get into the nitty-gritty of crypto mining so that you understand precisely what you’re doing when you set up your mining tools.
Instead of government issued money, you are paid with Bitcoins for adding new pages to the Bitcoin record book.
The Mining Process
Let’s start with an anecdote. Let’s say you and your friends at work decide to start a savings group. In order to communicate more effectively and have instant record keeping, you start a mobile chat group maybe on Whatsapp or Telegram. Let’s call it Ice Savings. As money is sent in and out of the group kitty, the transactions are recorded by group messages like “500 Received from Isaac into Ice Savings Account.” If money is withdrawn to give to someone it’s also recorded.
This system will probably work quite well for a small group but as it grows and more people get in, it’s going to be a challenge to keep track of who sent what.
One of the problems that such a chat would face is security and many companies have responded by encrypting data. This works by passing the message through a function that changes it to something else. For example, I could create a simple encryption right here by making every letter and alphabet change to the next letter with Z and 9 going back to the first. If you type a message like “I Received 300” the moment you hit send it’s first changed to “J SfdfJwfe 411”. The only way you can interpret this message is by knowing how I encrypted it. On the other end, the other users could have the encryption key so that the message is translated back to “I received 300.” Only someone with that specific key can decrypt the message.
With the key in place, the messages are now secure, but it doesn’t answer the question of what would happen if no one was around to see your message. What if you post several messages at 3 AM when everyone else is asleep or on a public holiday? Wouldn’t one of those messages get overlooked?
You see Bitcoin is decentralized. Messages on a chat such as Whatsapp are normally stored on the company’s storage system but with Bitcoin, there is no company storage server. Think of it like a chat where the app exists on you and your friends’ phones with none having more administrative privileges than the rest. If all of you logged off where would the chat history go? If only one person were online what would prevent them from recording data three or four times and then overdrawing from the group kitty? I’d probably write there Victor sent 10000 a few times. Can’t double counting also occur when I decide to withdraw more than once from the amount put in?
To counter this problem, the transactions are recorded in sets called blocks and each block will record the transactions going in and the transactions going out. That way, if you had not deposited into the block then you cannot withdraw.
Who creates these blocks? Where are they stored? They are stored on every computer that is connected to the Bitcoin network. That’s why when downloading it needs to update from the time mining started to the current date.
I’ve already explained how cryptography works at a basic level, what I haven’t explained is how it works at a complex level. Cryptographers don’t use such a basic formula. It’s too easy. The current standard used is the SHA 256 which converts data into 256 bits long information. So encrypted data looks something like 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010
This is a very long set and on top of that it uses hexadecimal, not binary, so you’d have an easier time herding cats than decrypting it. In fact, it’s not yet been done. The function used to change the data is called the SHA 256 function. Every time data is entered and encrypted it produces a result. When some data is converted, it can produce a result that ends with a certain number of zeroes. That’s what you’re looking for when you are mining.
The process of mining is basically transmitting a number, having it interpreted by the SHA 256 function and seeing if the result has the desired number of zeroes. If your answer is wrong then you can try another number. If it is correct though, you get rewarded with some Bitcoins. Theoretically, it’s something you could do with a pen and paper. However, practically, the numbers being dealt with are extremely large, somewhere between one vigintillion and one centillion if we’re using Arabic numerals.
The purpose of these correct numbers is to create addresses or rather, new pages for record keeping.
Remember your group’s messages are not recorded anywhere, they are decentralized and so somewhere is needed to record the transactions. This is what the hash functions do. Every time a number is found it forms the header for a block or rather a section of the ledger and the person who found that combination is rewarded with Bitcoins. That block can then be used to store transactions’ information. When a transaction is done it is recorded on one of the blocks. Not only that but when transactions are done with your block then the transaction fee goes to you. Just like that, the need for someone to check up on transactions is removed.
How It Started
The process started by getting the first correct function and the creating the first ledger so the mining came before the blockchain. Now you mine and get your reward. After the reward, you can spend it anywhere where Bitcoin is recognized that includes buying other currencies. What’s driving the price up? Why do insiders think there are better options? Well, that’s an entirely different story for another day.