# Introduction to XRB Nano (Previously RaiBlocks) Part 6

|**Proof-of-work and proof-of-stake on XRB network**

With Bitcoin, proof-of-work is the only way to create blocks on the network, thus validating transactions. With proof-of-work algorithm, a miner on the Bitcoin network and a user on XRB Nano/RaiBlocks network need to create a hash that corresponds to certain requirements.

On the Bitcoin network, these requirements are determined by a parameter that is called “difficulty.” The more miners the Bitcoin network has, the higher the difficulty and the harder it is to create a block on the network.

In practical terms, difficulty means that the hash for a block needs to have a certain number of zeros in the beginning of the hash. For example, the hash for the block #507607 on the Bitcoin blockchain network was 00000000000000000043ba88d872b99da792e747c9af3fe3751eb408bc5ed999.

Because a set of data can only have one hash, miners add a number to the set of data to come up with the winning hash. Otherwise, if they were to use the same data (the information about the transactions), they all would get the same hash.

The number that the miners add to the set of data is called nonce, which is short for “number used once.” For example, the nonce for block #507607 was 704286262. Once the miners come up with a nonce and a winning hash, both the nonce and the winning hash become a part of the Bitcoin blockchain.

All miners and users know what algorithm the network uses to create hashes (the algorithm is called SHA-256), so they can easily check the validity of the data.

In essence, proof-of-work means that miners are playing a lottery by picking nonce numbers to create a winning hash. The hash then serves as a tamper-proof stamp that protects the data on the Bitcoin network. The system works and the miners keep playing the lottery because the system is honest, transparent and the chances to win are realistic.

In most lotteries available to the public, such as Megamillions and others, the chances of winning are not realistic at all. People look at five numbers and a jackpot that they need to guess and think that the probability of winning is somewhere around five or six (the number of numbers they need to guess) multiplied by the options, which makes it somewhere between 1 in 500 and 1 in 1000 or so.

In reality, the potential probabilities are very different because they deal not with just numbers, but with ways to choose a subset of numbers from a larger subset. For example, the number of ways to choose a set of five numbers from the set of numbers 1 through 59 is 5,006,386. The probability of winning a powerball combination is one in 175 million. This chance is smaller than the chance of dying from an asteroid attack (1 in 74 million) or becoming a movie star (1 in 1.5 mllion).

The problem with probabilities such as 1 in 175 million is that they are impossible for the human mind to visualize. The highest number of objects of the same class that most people have seen in their lives would probably be a football stadium that contains between 50,000 and 100,000 people, but not 175 million.

If you were to play a lottery in which chances are, indeed, realistic, say, 1 in 100, you would need to play 100 times to win on average. 100 is not such a big number and if you were sure that there was no rigging, you’d keep playing and keep winning. This is exactly what happens with miners on the Bitcoin network. They keep coming up with nonces and creating hashes because they win mining rewards in bitcoins for adding blocks to the blockchain.

If an attacker were to change even one digit in the information about just one of the transactions in a block of the blockchain, the block would have a completely different hash and all members of the network would be able to see that there’s something wrong with the block.

The benefit of proof-of-work approach is that it works. It has been working since the inception of the Bitcoin blockchain in 2009 and has proven itself. The disadvantages of the proof-of-work are that it requires miners to burn a lot of electricity and stores all information in just one blockchain.

In the proof-of-stake algorithm that the XRB Nano/RaiBlocks network uses to resolve the issue of conflicting transactions, participants vote on the decisions such as validity of transactions based on their stake in the system.

One of the problems that all cryptocurrencies have to deal with is a so-called Sybil attack, in which an attacker creates multiple accounts and tries to overload the system. On the XRB Nano/Raiblocks network, the voting about adding transactions to blockchains takes into consideration the amount of funds in the accounts. If an attacker were to create a ton of empty accounts, he or she would not get any extra votes because the accounts are empty.

In addition to proof-of-stake, XRB Nano/RaiBlocks network also uses Proof-of-work. It uses proof-of-stake to resolve the issue of conflicting transactions and proof-of-work to protect the network from spam.

This is the main difference between proof-of-work algorithm on Bitcoin vs proof-of-work on XRB Nano/RaiBlocks. With Bitcoin, it is the main tool of protecting the integrity of the network. With XRB Nano/RaiBlocks, it is a spam-protection tool, which is why the difficulty of proof-of-work on the XRB Nano/RaiBlocks network is negligible compared to Bitcoin’s proof-of-work.