Cryptocurrency is pretty much a household term these days and if you’ve spent any time reading about the phenomenon you’ll probably have heard of “bitcoin mining” too. The mining of bitcoin, Ethereum, Litecoin, and every other digital coinage (with the exception of Ripple) is simultaneously driving up demand and prices for graphics cards. It has even led to the development of malware designed to hijack computer processing power for mining. But how does Bitcoin mining work?
Much like the gold rush, mining represents the opportunity for participants to be rewarded with a shiny new commodity. It’s not free, in the sense that you’ll need some powerful hardware and a way to pay the hefty electricity bills, but bitcoin mining is a way to obtain some cryptocurrency without having to buy it on the market. Miners don’t really do any digging for bitcoin, but instead are rewarded with new coins for participating in processing transactions and updating the “blockchain” using their computer.
Bitcoin miners are rewarded for processing transactions and updating the blockchain
The mighty blockchain
The key to all of this is understanding what a blockchain is and the purpose it serves in currencies like bitcoin. You can read about this in much more detail at the link, but we’ll cover the basics here.
In a nutshell, think of a blockchain as a public ledger or record that contains all of the information you want to store. For cryptocurrencies, this contains all of the transaction data ever executed in the currency. Each “block” contains data about where coins were sent and who owns them, and with Bitcoin at least, a new block is created every 10 minutes.
Every block also contains a summary of the previous block, which is created using a hash algorithm. A hash is, essentially, a way of encoding data of any amount of data into a fixed length, to act as verification. It’s a very handy way of encapsulating datasets that might grow or change over time, such as a blockchain, but it’s not the same as encrypting data. Importantly, even small changes in the data can create big changes in the hash, so it’s a good way of ensuring consistency over long periods of time.
For example, using the CRC32 hash algorithm, the world “hello” is transformed into 3610a686. So if I send you both the message and the hash, and you use the same algorithm on the message, you can check the hash and know that the message hasn’t been tampered with along the way. But if you received the word “hel1o”, the hash would be 3905859f, so you’d easily spot even a subtle change to the message just by comparing the hash.
So a series of blocks forms the “blockchain” and the important component that links them all together is the hash data of the previous block – makes sense? The hash here is very important because it allows the currency to check that a newly created block, or updated transaction record, is consistent with all the existing blocks, and that someone hasn’t attempted to retroactively change information. The most obvious example of such a sly change would be attempting to say that a wallet contains more bitcoins that it should.
Creating a basic hash isn’t too difficult, but cryptocurrencies specifically implement difficult computing requirements (starting a hash with a number of zeros) in order to prevent manipulation and to act as a “proof of work” that ensures integrity, kind of like long division in school. A difficult hash that requires a lot of computational effort to solve is more trustworthy than a simple problem that requires very little work. This is because guessing a lot of incorrect hashes gives you a lot of examples of results you know are wrong.
It takes a long time to calculate all the possible input values that would produce a hash with the desired characteristics, which is where powerful processing hardware comes into the picture.
To sum up, the hash is used to secure a chain of blocks intrinsically linked to one another (a blockchain), as previous block hash data is used to create the new block. It would therefore be very difficult to create a fraudulent block of chains inconsistent with the publicly distributed data.
Mining digital currency
Now that we understand the basics of how blocks and hashes work together to form a blockchain, we can take a look at the concept of bitcoin mining. At this stage it’s also important to remember that cryptocurrency data isn’t stored in one central place, it’s spread around numerous public nodes which communicate with one another over the internet. As a simple explanation, bitcoin mining is essentially receiving payment for processing transactions, but let’s dive a little deeper.
Bitcoin mining can be split into a selection of parts. The first is compiling a list of all the new transactions since the last block was created, creating a new, updated one which includes recent trades of Bitcoin on an exchange or in payments between Bitcoin wallets. Mining then takes the header of the previous block and combines this into a hash. Finally, all of this is put together into a completed block, which is sent out to the network and accepted as part of the chain.
Computers crunch through this hashing algorithm in a race to be the first to find a solution below the target number. This is purely an effort in trial and error, although the approximate computing time required to solve the puzzle is known. The bitcoin network is designed to create a new block roughly every 10 minutes, regardless of the number of users in the network. As popularity surges the difficulty and individual calculation time for the hash increases, but it could also fall in the future.
Mining doesn’t itself create new coins, instead these are given as rewards for calculating new blocks in the chain
Once the new block has been successfully calculated, it is announced to the network and the solver is awarded a new amount of the currency as a reward. Pooled mining networks will split this reward among its contributors, making it possible to earn fractions of currencies for participating in block creation. The new block can be easily checked to be consistent by other nodes in the network, and work then begins on figuring out the next block.
Given the distributed nature of cryptocurrency data and the fact that users are working in parallel to solve hash problems, it’s possible that two or more users may solve a block at any one time. In this case, the one with the largest total proof of work is accepted by the network. Again, this is because the more complex the computational work to achieve it, the more reliable the hash.
How cryptocurrency is mined
Given that calculating a hash is just a mathematical algorithm, they can be solved on common processing hardware, such as the CPU inside your computer or even your smartphone. However, as you’d want to do lots of mathematical calculations as quickly as possible to win the reward and without consuming too much power (cost), graphics processing units tend to be faster. While fast multi-core CPUs may be capable of handling tens of math instructions at once, GPUs can handle thousands.
Each cryptocurrency uses slightly different algorithms, some of which are designed specifically to run better on certain type of hardware, but the vast majority of these calculations are performed most efficiently on highly parallel processing units like GPUs. Better yet, custom FGPA and ASIC hardware designed specifically for mining algorithms can handle even more mathematical operations at a time to speed up the process.
Bitcoin mining algorithms run efficiently on highly parallel processors, such as graphics cards.
In addition, each currency also has its own selection of networking and mining software which enables mining on specific pieces of hardware, such as those listed above. They’re also essential for connecting to the wider currency network in order to grab transaction data and push completed hashes to the system. Most of these enable solo-mining but it’s more common for individuals to join mining pools, which will split the proceeds of block generation to its members, based on the processing work they contributed.
Originally, miners were cryptography enthusiasts, but now everyone from casual observers looking to spare a few GPU cycles right on through to industrial scale operations take part. The power needs of commercial Bitcoin mining operations in Iceland are ready to overtake its residential energy consumption this year, due in no small part to the country’s cost effective hydropower. Overall, bitcoin mining and the greater network is estimated to consume as much power as Denmark!
Cryptocurrency mining is almost as large a phenomenon as the digital currencies it generates. It has spawned a wave of interest in cryptography and blockchain, and drawn the interest of huge commercial operations looking to cash in on the cryptocurrency craze.
There are a lot of variables outside the scope of this article that weigh heavily on whether it’s worth becoming involved in bitcoin mining or other currencies. These can range from regional prices of electricity and graphics cards, to the current hash times and difficulties involved. Hopefully this serves as a springboard for your own research. Either way, as long as cryptocurrencies remain a hot commodity, there are bound to be people and companies looking to do the work of finding their own little nugget.
Want to learn even more about Bitcoins and crypto? Be sure to check out the following guides from the Android Authority team:
- What is Bitcoin?
- What is IOTA?
- What is Ripple?
- What is Dash?
- What is Ethereum?
- The best Cryptocurrency apps
February 27, 2018 at 06:07AM