Cryptomining — What do miners actually do?

Hashtrend AG
Sep 24, 2018 · 17 min read

Mining is one of those words that keeps popping up in conversations about blockchain technology and cryptocurrencies. Everyone kind of knows its meaning or can at least cite the line used in simple explanations: “miners create new blocks by solving mathematical puzzles”.

But is that what they actually do? It sounds like some geeks are doing random sudokus trying to win magic internet money. How much of this is true? Is the concept of mining so complex that non-miners will get lost in the specifics or can we break down the mechanics and maybe come up with a more accurate term than “puzzle”?

Let’s find out.

In order to work through the specifics, we will take mining Bitcoin blocks as an example. Obviously, other blockchains will use altered methods, different parameters and their own descriptions. We just want to understand the principle how-and-why of mining and the relation between the “puzzle” and transactions in particular.

Proof of Work

While talking about mining, we usually refer to Proof of Work (PoW). This is the verification method used in many cryptocurrencies, Bitcoin and Ethereum being the most famous ones. Proof of work was designed to prevent email spamming and DoS attacks in the 1990s. It slows down service requests (e.g. sending an email) by requiring a certain amount of computation.

It breaks down like this:

Alice wants to send a happy birthday mail to Bob. She writes her best wishes, enters Bob’s address and clicks send. This is a service request. The message will not be sent before Alice has computed some random stuff, which takes up a tiny amount of time and power. Sending one message is relatively easy and Alice will not even notice the delay.

Carl is pretending to be a Nigerian prince with 2 million USD in the bank, hoping to find a new friend who will send him the money needed to release his fortune. He writes his desperate plea, enters 1,000 addresses and clicks send. These are 1,000 service requests. The tiny bit of computing is multiplied and it’s barely possible for Carl’s normal household computer to perform.

So what are we protecting on the blockchain?

In cryptomining, PoW is used to protect the blockchain from spamming and manipulation. The computational power is not required from the users making transactions, but from miners that try to solve the block and earn the transaction fees and new Bitcoins minted in the process. To figure out the mining process, there’s a couple things we need to understand: Blockchains, block structure and cryptographic hashing.

OMG, that sounds really hard. Do we have to?

Yeah, kind of. But it’s not as hard as you think. People without a technical background can still learn pretty much everything there is to know about mining. As long as we take little steps and don’t get lost in details, we’ll be just fine. You can also google your way through more detailed articles once you’re really into the subject. We’ll start off with blockchain, which is easy.

The Blockchain

Blockchains were invented to store data in a decentralized, non-modifiable and transparent way. That is the basic idea and the standard form. Without going too much into detail, we’ll just take this one phrase apart and then see how far we get.

Data stored on a blockchain can be basically anything. On the Bitcoin blockchain, we mostly find transaction data: e.g. Alice sent amount x to Bob at 3pm — just your basic numbers. There is also some subsidiary stuff — proof, that Alice has enough Bitcoin in her account to send some to Bob and some other block information that we’ll get into later on.

As the technology develops and clever people keep coming up with good ideas, the possibilities seem endless. You can store personal data (civil or ID service), tracking data (cars, diamonds, organic cocoa beans) or chip numbers (wildlife surveillance, pets) on the chain.

2. Decentralized

Decentralized or distributed has become the magic word for everything online lately. It means that data is not stored on one central computer or server, but copies are kept on several different devices. All copies are connected. Every time something new has been added, all copies are automatically updated.

Don’t get confused though! The term is also used to describe the anatomy of most cryptocurrencies: there is no central bank that mints or gives out coins. In our explanation, we’re focussing on the copies of the data being all over the place.

3. Non-modifiable

Once the data is submitted to the blockchain, there is no way of changing it. Since the information is stored in so many places, it is impossible to manipulate the numbers. You would have to hack your way into an enormous amount of servers at the same time.

There are some theoretical possibilities to attack the blockchain, but they’re really hard and we don’t need to understand them quite yet.

4. Block + chain = blockchain

The data stored on the blockchain is not one huge blob of numbers and code. Transactions or other info are packed into blocks. Some blockchains have perfectly equal blocks (Bitcoin), others have variable sizes (Monero).

Once a block is filled up with information, miners (that’s their usual name) will wrap it up and link it to the last block. This is how the blockchain is created. Everyone with a copy of the blockchain will now have to update and add the new block.

5. Transparent

The blockchain cannot be modified, but everyone can have a look at the existing data. Using a tracker/explorer (a website or interface that helps you navigate and gives you some search options), you can find a specific transaction or other input.

You can also just browse the blocks, watch new blocks being added or simply trust us on this one and read on.

When you’ve understood the basic idea behind the blockchain, there are loads of varieties to be discovered. Most new coins with their own blockchains try to solve a certain problem, e.g. scalability or privacy. Nano gives each user their own private little blockchain > zero transaction time. Monero trades transparency against absolute anonymity. EOS and NEO choose security over decentralization.

Cool, right?

The next thing we want to understand is cryptographic hashing. Once again a term that sounds like you need a Master’s Degree in Data Engineering, but for our purposes, a basic understanding will do just fine.


Cryptographic hashing is a technique used to compress data. As with the blockchain, we will only get into the technical side as far as we have to. Think of it as a mathematical blackbox: you put numbers or text in, magic happens, and it spits out a string of numbers and letters. There are many different methods to generate hashes — Bitcoin uses SHA-256, so that’s the function we will take as an example.

Four important aspects are:

A hash is generated by squishing input through a function that renders a hash. If we put “Hello” through the function, it spits out this (hexadecimal) hash with 64 digits:


Contained are the numbers 0–9 and the letters A-F, also known as alphanumeric.

”Hi there aspiring miners!”


“Notice anything peculiar about the hashes?”


“We could copy Tolstoy’s entire War and Peace novel and we’d still end up with only 16 digits!”


The size of the input is not important for the output. Using the SHA-256 function, the hash result is always the same length. The alphanumeric display with 64 numbers and letters is the easiest display for human beings. Robots prefer a binary display: 256 zeroes and ones. We’re sticking with humans though.

Try SHA-256 and other hash functions for yourself on

2. Hashing is a one-way street

It’s always fun to experiment with encryption. Try typing phrases into a hash generator and you will see that each letter and change to upper- or lowercase will affect the hash. But there’s no point in sending an “I love you” hash to your special someone — there is no reversing method, so they’ll just end up confused — even the robots.

This is the big difference between cryptographic hashing and (end-to-end) encryption. If Alice sends a message to Bob, the service will encrypt the message while it’s flying between phones and decrypt it for Bob to read. Once a message is hashed, there is no retrieving the original.

3. It is really simple to check a hash

We might not be able to reverse a hash, but every three-year-old can check if it is correct. If we tell you that the hash for “Bitcoin” is 1be005fc380549a1e3a18c8aad6463284cc7d967b8295f82bf9b7852247abb26, you can simply copy the input, compare the hashes and come to the conclusion that we lied. You have no clue what the input has been, but you can be certain it wasn’t Bitcoin. In case you’re wondering — it was „Hashtrend“ :)

4. Merkle Trees are just hash-pyramids

A Merkle Tree compresses transaction data using the hashing function. This is important data contained in each Bitcoin block. The tree comprises all transactions and other miners can check its validity. The hash at the top of the tree is called the Merkle Root.

Say what now? What’s Merkel got to do with it?

Nothing. It was Ralph Merkle who came up with an idea to compress data in a tree. Or pyramid — whatever image you feel more comfortable with. Let’s say there are 500 transactions in a Bitcoin block. That’s 500 lines of “address A sends x BTC to address B”.

Ralph did not want to just copy everything and hash it at once. That would have been the quick option, but his tree has some benefits when you want to prove stuff to other miners. So what did he do?

When there are 500 transactions in the block and we want to put them in a Merkle Tree, we start hashing individual transactions. We now have 500 hashes sitting next to each other. This is the base of the tree.

Next step is to pair them up. We take two hashes at a time and put them through the hash generator. To be precise, we double-hash. We put the info into a hash generator and then use the hash itself as input:

Don’t get confused — it’s not that important, really. What you need to understand, is that because we’ve been pairing up, the second layer of the Merkle Tree is half the number of hashes: 250.

Rinse and repeat and we end up with 125 hashes on the next layer. Now we have a bit of a problem: we cannot split a hash. To keep an even number, we duplicate the last hash. 125 + 1 = 126. With 126 we’re good to go.

Pair up once more and we’re left with 63. Same problem? Same solution. We duplicate the last hash to make an even number (63 + 1 = 64) and from 64 onwards, there is no need for cheating anymore.

Paired up to a layer of 32, goes down to 16, goes down to 8, then 4, then 2, and finally 1. This final hash is known as the Merkle Tree Root.

Are you still with us? Good. It gets easier from now on. Well, kind of.

Block Structure

It’s not just the chain that brings structure to the blocks. Each individual one has a special anatomy. It can be divided into a block header and a block body. The header contains the important information about the previous block, the transactions contained and the mining specifics.

Block Header

A block header contains six pieces of information:

The block hash from the previous block in the chain allows us to figure out where this block belongs. When you (as normal human being) use an explorer, you’d look at the block height/number to work out where this block goes. For miners, listing the previous hash makes more sense.

2. Merkle Tree Root

This is the final hash from the pairing-tree we discussed earlier on. All the transactions listed in the body of the block have been paired up and double-hashed until only one hash was left and that’s the one saved in the block header.

3. Target

The Proof of Work target is a bit tricky, because we haven’t gotten around to explaining it yet. It is a value that goes into a formula, which tells miners the difficulty of the block. They can use this number to figure out how many zeroes the hash has to start with. We’ll get back to this in a bit.

4. Timestamp

The timestamp contains the date and time when the block was created. A miner will typically pick a time somewhere in the next 2 hours as a placeholder whilst trying to mine the block. This is why timestamps can be off a little bit. The margin is not allowed to be more than two hours into the future.

5. Version

The version is the number of the software version or the protocol that has been used to mine the block.

6. Nonce (number used once)

This is the only variable piece of input in the block header and it consists of 10 numbers. Miners will keep changing the value of the nonce until they can mine the block. Seriously, we’re getting to it.

Block Body

The block body consists of transactions. These are strings of wallet addresses of the senders and recipients, amounts of Bitcoin, signatures and some other data that we don’t need to get into here. There is no fixed number of transactions per block in Bitcoin. The data in one block may not exceed 1 MB. Miners will try to pack as many transactions as possible into one block. Apart from maybe the amount of fees contained in the transactions, the miner will not care about the individual transactions.

Once again: What is mining?

After all this building up, we can finally get to the point. What is it that miners actually do? They try to figure out what number is missing in the input that leads to a certain hash. Yes, we know we said it is impossible to decrypt a hash. But mining is not witchcraft. They’re also not decrypting anything.

They just guess, guess and then guess some more.

The first step of mining is to create a candidate block. This is a kind of dummy block — if you get to mine it, it will be part of the blockchain. If someone else is quicker, the candidate block is discarded and miners start a new one.

A miner has to put the most important transaction/command in the candidate block straight away: transfer 12,5 new Bitcoins (the current block reward) + the collective transaction fees to the miner’s wallet. This is called a coinbase transaction. It has no input, as the 12,5 BTC were minted and did not come from an existing wallet. The fees of individual transactions are added to the block reward.

Once the miner has secured his potential income, transactions can be added to the block body. Transactions that have already been verified in the last block have to be filtered out. Once the body is full (a Bitcoin block may not exceed 1 MB), the block header data can be filled out.

Remember the 6 points? The previous block hash is simply copied from the last block on the blockchain, same as the target (in most cases). With all the transactions in place, they can be paired and hashed to create a Merkle Tree. The Merkle Root is also added to the block header. The timestamp can be any time in the next two hours and the version depends on the software/protocol that has been used. The nonce is set to zero (default).

When the information in the block header is hashed, the SHA-256 function will spit out the usual 64 alphanumeric hash.

This is where the difficulty/target thing comes into play.

The Proof of Work target is a factor that miners need to consider when hashing the block header. The target value determines how many zeroes have to be at the start of the hash (the amount of leading zeroes). The more leading zeroes are required, the more difficult it gets to generate a valid hash.

If we take Bitcoin block #445566 as an example, we see that the block hash is

00000000000000000331ab3efa91b7dc3dfbe0164456b5d35a285af8358f4724. That’s 16 leading zeroes. Older blocks usually have fewer leading zeroes. Future blocks will most probably need more.

But how do I get the function to burp up a valid hash?

Simple: by changing the value of the nonce. Because a hash function has no predictable formula, there’s no way of cleverly adjusting the nonce. It’s brute force all the way: miners will just squeeze as many block headers with different nonces as possible through the function until a hash with sufficient leading zeroes comes out. The more nonces they can throw at the block header, the higher their so-called hash-rate.

If we illustrate one unsuccessful and one successful try, it looks more or less like this:

As soon as a miner has come up with a valid hash, the block is sent into the network and other miners will check the numbers and see if:

● … the block header hash is below the target (correct numbers of leading zeroes)

● … the block size is not more than 1 MB (Bitcoin)

● … the timestamp is not more than +2 hours off

● … the first transaction is the coinbase transaction

● … the transactions are valid (and not copied from the last block)

If everything adds up, all miners will copy the data and the block is permanently locked in the blockchain. The race starts again: the coinbase transaction and unverified Bitcoin holder transactions are packed in a candidate block, the parameters are set and the search for the next valid hash is on.

In Bitcoin, a new block is mined every 10 minutes. To make sure that this time range remains the same, the difficulty (target) is adapted every 2016 blocks. If new and more powerful hardware has allowed the block time of approximately 10 minutes to go down, the difficulty is increased. If the block time averages more than 10 minutes, the difficulty is decreased.

Bitcoin difficulty over time — interactive chart here

Mining Incentives

Now that we know what miners are up to: let’s put the blockchain philosophy in the spotlight for a second. As most of you will know, Satoshi came up with the Bitcoin concept as an alternative to traditional banks. He was aiming for a digital currency that anyone could use without a central authority and therefore without trust.

The magic word: decentralization.

Remember the blockchain copies scattered (distributed) over different servers? For the decentralization of a cryptocurrency, some things need to be distributed as well. First of all, the coins themselves: if one person owns all the coins, they lose their value. When many people own coins and use them as a means of payment, it keeps the currency healthy.

Same goes for the miners. The more distributed the miners are, the more decentralized the currency is. Miners will verify transactions and in their competition of trying to mine the next block in order to get the rewards. They don’t care about the addresses and amounts of Bitcoin in the block, because they do not influence their gains. This allows for trustless transactions: no transaction will be blocked or ignored for personal, political or corporate reasons.

When mining capacities are distributed, nobody can censor certain transactions or change data. This would require hacking more than half of all miners at the same time, known as a 51% attack.

However, the decentralization of currencies can be jeopardized by different developments. At the start of the Bitcoin blockchain, it was easy (for people with the technological knowledge) to mine with their normal computers. It soon turned out that graphic boards (GPUs) were more suitable for the job than CPUs. Miners with better equipment had a higher chance of mining new blocks.

Obviously, large tech companies jumped in and developed advanced and expensive graphic boards especially for mining: Application-Specific Integrated Circuits (ASICs). The richer miners that can afford the better hardware will get more blocks. So they started to get together in mining pools to combine their mining power.

But apart from being the decentralizing hero, there’s good money to be made.

With each new block, 12,5 new Bitcoins are created and go straight into the miner’s pocket. This number once started at 50 BTC and halves every 210,000 block. It will continuously decrease until the maximum supply of 21 million BTC has been mined. Added to the newly minted coins are the fees of each individual transaction in the block making the exact reward of mining a new block fluctuate a little.

Total Bitcoin over time — data found here

Mining Profitability

The promise of 12,5 BTC per block sounds like a shortcut to Lamboland, but before you pick the color of your new Huracán, you might want to check the actual profit margins of your new venture. If you didn’t get into the business years ago, you’ll be facing some stiff competition.

Aspiring miners tend to start mining with their own hardware and come to the conclusion that it’s fun to let an old desktop run, but it will usually be collecting pennies at best. Cute, but you can’t quit your day job just yet. The next step for most enthusiasts is cloud mining. A good cloud mining package offers you hashpower at a fixed price. You basically rent someone else’s hardware and don’t need to worry about the risks involved.

If you’re not up for sharing profits, you’ll need to smash your piggy bank.

Starting up a mining farm from scratch is a huge investment (and an awful lot of stress). You need air-conditioned space, ASICs, power distribution units — but most of all electricity. At normal household rates, the electricity bills of a mining farm would go through the roof. That’s why most miners will opt for locations in cold regions (less aircon costs), set up near a power plant and get a good price on pre-purchased electricity.

Once a farm is up and running, well-monitored mining rigs will do their thing 24/7. Assuming that the equipment is not outdated, the hashpower of a healthy farm will suffice to mine enough blocks to make a profit. Essential for the competitive edge are the reduction of the time-to-mine (the time it takes to commission a mining machine > setup, configuration) and the minimization of downtimes, during which the machines are not actively mining.

But let’s get into mining hardware and facilities next time.

For now, you should have a basic understanding of Proof of Work and Bitcoin mining. Do you want to learn more or get started yourself? Come and check out, join our social media channels and ask us your questions.

By the way…

Please note that mining profits are generally considered part of your income and that fiscal authorities will want to know where the money for your new jetpack, yacht and olympic-size ball pit came from.


Bitcoin Mining is hashing block information and trying slightly different inputs until the output hash lives up to expectations. The first one to come up with a good input (a correct nonce) can finish a block and claim both the new Bitcoins and transaction fees from the block.

Miners are important to keep the blockchain going and make sure the cryptocurrency stays decentralized. It’s not always easy to get into mining, because the equipment has become more and more professional.

Sources used:

Hashtrend AG

Written by

Our in-house developed mining ecosystem takes on all challenges in cryptomining ➤ learn more about us and our products

Hashtrend AG

Written by

Our in-house developed mining ecosystem takes on all challenges in cryptomining ➤ learn more about us and our products

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store