Skip to content

Bitcoin Mining

Bitcoin Mining

This article is about the eventual understanding of the Bitcoin Mining process and how to go about doing it. There are no pickaxes or blasting caps required to remove anything from the ground. Mining is not even the art of finding something physical. Mining is just a word used in the cryptocurrency industry to describe a computational process of calculating hashes of specific elements.

Let us explain.

Each transaction is identified by a transaction ID, and that transaction is placed into a group waiting to be placed in a block. The miner has the prerogative to choose whichever transaction he wants, and most miners choose the transactions that have the highest tips (in addition to the payment fees and senders. So one of the things you can do if you want the fastest block inclusion times is to bump up the tip, and you will find your transaction gets included very quickly.

There are numerous miners all competing to do something interesting – they pair up all the transaction IDs and run them through a hash function that returns a single hash. If they have 256 transactions, then they get 128 pairs of transaction IDs. Once each pair is processed, the miners are left with 128 hashes. These are then paired again, and then again until they are left with one final hash. So 256 Transaction IDs become 128 hashes, 128 hashes become 64 hashes, and 64 hashes are paired again and become 32 hashes. That’s paired one more time and results in 16, then hashed in pairs again to become 8. The pattern continues down to four, then two, and finally, the last pair is hashed which results in one hash.

Hash Functions

What is a hash?

A hash is a precise, mathematical function that takes the content of a file and condenses it down to a specific set of numbers which is deterministic. Take this random phrase for instance: “apples in the spring” (without the quotations). This particular sentence results in a hash that looks like this:

B5E72AF8031A87A248FC8A6955DF758CFAA97FD9C0183F38AD6A7ADCB522AF3A

It looks like a random string of alphanumeric characters. And that’s what it’s expected to look like. But it is not random. You can try an online convertor for a SHA256 here:

https://passwordsgenerator.net/sha256-hash-generator

If you took the “apples in the spring” sentence and plugged it in there, you would get the same string of numbers.

The thing about hash functions – and there are many different ones (this one being the 256 SHA, another being the 512 and so on) – is that they are asymmetric. That means you can only go in one direction. If you have the hash, you can’t go back to the original text. You also can’t reverse engineer it. See how vastly different the hash is after just altering that sentence to this: “Apples in the spring”. It is the same sentence except the first letter is capitalized. Now look at the hash and compare it to the earlier one:

6378FFCC7B0529D3E5C5E3885B55805E5167E64A570D6926B491E4D55099CC60

The vast difference in the hash output makes it impossible to reverse engineer the original word, text, or phrase. You can even hash an entire book. The point is that if just one alphabet, punctuation, spacing, or an entire chapter is changed, the entire hash that represents it changes drastically.

This is a powerful way to make sure that nothing gets altered once it is recorded. So, take two transaction IDs like these:

97566b492888b59b34a4b88ddd9764c0fef9eb5c6534b69c76e3c9f3f180e2e5
8c11d9ff4f114e0a35e4882cffac1d3476b3e56a752a0c38fccd6d0f4499c0f8

Now, hashing these two transaction IDs, we get:

7595DA286B700671D0256AD0B125EE011A25E12E8CFC9C446EC8090D97D60999

That’s the hash for the two transaction IDs. Once we get those hashes and put them in a block, that block becomes part of the history of the Blockchain and those transactions cannot be altered because Bitcoin does not allow you to alter a transaction. If you need to, you have to do a new transaction or ask the person you sent the funds to refund it. There is no reversal in Bitcoin or Blockchain. Once a transaction is done, there is no way to reverse it because it gets memorialized in the Blockchain. This is leading up to the actual mining process.

The entire Bitcoin network works because of the algorithm that underlies the system. It is loaded and deployed across each node – and automatically does what it is supposed to do as far as passing on messages of transactions and updating the ledger. Bu the real power comes in the mining process. All miners are also nodes.

This algorithm also does a few other things in terms of monitoring the block creation process. It makes sure that each block is created in a specific amount of time – which is ten minutes. Further, it ensures that the rewards are dished out to the successful miner.

Proof of Work

But to keep within its ten-minute rule, it has to constantly monitor how fast the blocks are being completed and solved. When it finds that the blocks are being solved fast, it increases the difficulty of the output so that the miners have to spend a long time finding the solution and succeeding at the output, which is called the Proof of Work.

The reason a solution is the proof of work is that you have to do the hash computations to get the solution, and there is no way of guessing it. So if you have found the solution, it is because you worked at it – that’s the proof of your work.

How does this work?

When the miners are creating the block, they have to include the transaction IDs, the header, and everything that is supposed to go into that block – plus one more item called a nonce.
A nonce is a random number, but it’s not just any random number. It is the random number that will make the hash of their entire block, including all the transaction IDs, fall within a certain range. It’s not as easy as it sounds. Let us show you.

To create the block, you have to take all the transactions that you are including, and also the hash of the previous block and a number of their things, including the time stamp and so on. Now when you put those together, you realize that there is nothing you can change in there, so the resulting hash is pretty much fixed. But then you have to add the last item – the nonce and you can control that nonce. When you change the nonce, the hash for the block changes.

The job of the miner is to put the transactions in the queue into the block, hash it, and then find the nonce which conforms to the format that the Blockchain algorithm specifies.

When there is low hashing power available and the block times increase beyond ten minutes, then the algorithm monitors that situation and reduces the difficulty level so that the miners can get to a solution faster.

Nonce

How do these miners find the solution to the nonce?

They do it at random. The first has the block and includes a random number. If that doesn’t give them the desired output, they try it again, and again, and up to millions of times more until they get one of the random numbers to adjust that has just enough so that the hash falls within the format that the algorithm has assigned.

If you visit https://www.blockchain.com/charts/hash-rate you will see the total has rated in the entire community that is mining Bitcoin. What does that tell you? Well, it tells you how much processing power there is to hash the blocks. The more hashing power there is in the community, the easier it gets to obtain the solution, and when it gets easier, the time to reach the solution decreases. The moment the time decreases, the algorithm raises the difficulty of the target hash and then equalizes the entire community and returns the block rate to ten minutes.

Why does this happen?

This is so that there is a steady and predictable rate of bitcoins entering the market. If you recall, we mentioned that each miner gets a reward for mining. Now you know what mining is – it’s just the hashing of the block to get a particular nonce that fits the algorithm’s requirements. It’s pure processing power that needs to be expended to get the solution. That requires electricity and investment in hardware, and in return for that, miners are given this reward. At this point in time, the reward is 6.25 bitcoins per block. That also means that 6.25 BTC is released into the system every ten minutes. In most cases, miners turn around and sell the coins in the market in return for services or dollars, and that creates a supply of coins in the system.

Mining Rigs

A rig is a setup that includes the processing The best rig that you can put together would involve one that is built on ASIC technology. ASIC stands for “Application Specific Integrated Circuits.” They consume less power and are faster than just running GPUs, and what is more, they are the only technology out there that can compute the hashes fast enough to be able to keep up with the power required today.

The price range varies between five hundred and three thousand dollars per rig, and that does not include the power supplies, the fan, or the racks that you need to mount them on.

nv-author-image

Era Innovator

Era Innovator is a growing Technical Information Provider and a Web and App development company in India that offers clients ceaseless experience. Here you can find all the latest Tech related content which will help you in your daily needs.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.