Proof of work on the Monero network.
Just like the Bitcoin network, Monero uses a proof of work algorithm to create blocks of the blockchain.
Miners on a financial blockchain network such as Bitcoin or Monero compile transactions into the blocks of the blockchain, which is a trivial task for modern computer hardware. For this reason, Satoshi Nakamoto, the creator of Bitcoin, has implemented the concept of proof of work using the SHA-256 algorithm. A proof of work protocol is an economic measure that allows a computer network to avoid service abuses. An example of a proof of work protocol is a website requiring a person to type a CAPTCHA word before accessing a part of the website or using a service that the website provides. The difference between CAPTCHA and proof of work with Bitcoin and other cryptocurrencies is that with CAPTCHA it is a human being who is proving the work and with cryptocurrencies, the proof is being done by the computers.
Here’s how it works: first, computers compile transactions into a block of data. Then, they come up with a hash for the block. A hash is a string of data created by an algorithm. A hash has several important properties. First, a cryptography algorithm applied to a set of data will only return one hash. Second, this hash will always be the same for the same set of data. Third, it is not possible to recreate a set of data from its hash. Forth, even a small change to the set of data will change the hash significantly.
For example, let’s say you have the following information for the financial transactions: date, time and amount. You have five such transactions. This means that you will have the following set of data (Date 1, Time 1, Amount 1, Date 2, Time 2, Amount 2, Date 3, Time 3, Amount 3, Date 4, Time 4, Amount 4, Date 5, Time 5, Amount 5). This is a lot of data for just five transactions, yet when you run this data through a hashing cryptography algorithm such as SHA-256 that the Bitcoin network uses, you will receive just one string of a certain length. Let’s assume that we applied a cryptography algorithm A and received a hash of 0002 for the above set of data.
On the Bitcoin network, miners need to create a hash for the transactions that they compile into blocks of blockchain that is smaller than the hash of the previous block.
The degree to which the hash for the next block needs to be smaller is determined why what is known as “network difficulty.” One of the goals of the Bitcoin network is to add blocks to the blockchain at the speed of 1 block per every 10 minutes. When the network has a lot of miners the difficulty increases. When the number of miners goes down, the difficulty goes down, too.
A set of data can only have one hash, which is why miners compile transactions into a block and then add a random number to this set of transactions. This random number is known as “nonce,” or number used once. If the number a miner chooses results in the block having a smaller hash than the previous block, the miner wins the block reward. If not, the miner needs to keep trying. This means that essentially miners are playing a lottery trying to come up with a small hash by compiling transactions and combining them with a nonce. This is how both Bitcoin and Monero networks have implemented proof of work.
However, Monero doesn’t use SHA-256 because SHA-256 mostly needs the computational speed of a device processor, which means that miners with faster processors can potentially take over the network. Developers of Monero believe that memory size of modern computers is something that is less likely to vary among the users of the network than processor speed. For this reason, Monero uses CryptoNight proof of work algorithm instead of Bitcoin’s SHA-256. CryptoNight is suitable for regular computers and doesn’t need any special mining hardware. Bitcoin’s SHA-256 is a “processor heavy” algorithm, which is why Bitcoin miners with expensive graphics cards and fast processors have an advantage over Bitcoin miners with slower machines. Monero’s CryptoNight significantly reduces the advantage of miners with powerful graphics cards and processors over miners with regular computers.