# How Bitcoin and Crypto Mining Works?

12 Feb 2015

The Bitcoin mining process involves a set of steps that ultimately encourages miners to compete by using computer power through random brute force – or essentially trial and error- to come up with a hash that meets certain criteria.

First of all what is a hash – a hash is simply the result of feeding some data into a specific algorithm.

In the case of Bitcoin this is the SHA-256 algorithm – or the Secure Hashing Algorithm which is 256 bits long.

This hash cannot be worked back from and is a one way process - the amount of computer power to reverse out of it is almost unimaginable. It is simply a string of numbers and letters of fixed length. The other key point is that any input of any length and it is almost impossible to find two inputs that produce the same hash output.

If you were to hash the sentence: cryptocompare you might get a hash like below:

14nmoa4mk1

But if you were to hash CryptoCompare1, you would get a completely different hash as below:

0fj7183oci8a2

The hash has to meet certain criteria to be adopted into the Bitcoin or crypto currency blockchain. This is set by the difficulty, which in turn is set by the amount of computer power trying to solve the problem. For example if there were ten people trying to solve a problem it would take a tenth of the time to solve the problem than if there was just one person. The idea is to keep the block generation time, i.e. probability average of the hash being found, set to ten minutes.

So if there are ten people solving the problem the difficulty might be 10, whilst if there was 1 the difficulty would be 1. This difficulty is reset every two weeks and is based on the average network hash power (how many attempts per second the number of miners attached to the network can make to find a correct hash).

If the network hash power increases then the difficulty increases to keep the average time to solve a block the same.

The difficulty is a requirement in terms of the number of zeroes at the beginning of particular hash in order for a hash to be considered a solution by the rest of the network. For example of finding a hash with two zeroes at the start like below:

0012h3h1j34n

Would be more likely than the probability of finding a hash with three zeroes as below:

000rrkkw123h

All of the miners in the network are searching for a solution that fits the difficulty criteria and they do so by processing running their mining rigs to try and find the solution. This is why its called proof of work as its proof is the probability of finding a correct solution usually takes an average of ten minutes.

With mining, it is important to understand the different types of blocks that come with it because of the effect it can have on your expected income. This article provides a comprehensive insight into orphan, uncle & genesis blocks.