## Sell samsung galaxy s2 cex

12 comments### Monero mining guide

Proof-of-work is described in the Bitcoin whitepaper and Satoshi Nakamoto's key contribution to Bitcoin that differentiates it from preceding digital currencies. Proof-of-work demonstrates that a hard puzzle was solved. The puzzle consists of hashing the contents of a block and adding a nonce until the returned hash starts with a defined number of zeros. The amount of zeros that is required determines the difficulty. Finding the right nonce to compute a hash with the right amount of leading zeros is computationally expensive, however verifying its result is comparitively easy.

Every transaction on the blockchain before it is accepted has to be backed up by proof-of-work. Let's quickly refresh how hashing works and how it's used in Bitcoin. A short Ruby script gives a simplified idea of how it works in practice. The hashing algorithm SHA which is used by Bitcoin works by taking an input and returning a deterministic output which is unique to its input. A slight variation of the input will return a completely different output. Also two different inputs should not generate the same output and the output is of fixed length, independent of the input.

It's infeasible to reverse the hash, so the output does not reveal the input. Hashing relies on math that takes advantage of the fact that multiplying prime numbers is easy, but it is very hard to find the factorials that result in the same output. If we take the string "hello world" and run it through a SHA hash function we get b94d27bd3e08a52e52d7da7dabfacefe37aeef7ace2efcde9.

You can run this code in your terminal or use an online hash generator to test this yourself. If we now wanted to find the nonce that combined with the string "hello world! The nonce in this case is a number added to the end of the string. It took us 50 hashes to find the right nonce which appended to the string "hello world! The difficulty exponentially increases relative to the 0s required in the output. To get an ouput with five leading zeros the nonce has to be , which translates to more than 2 million attemps.

At the time of writing this the Bitcoin proof of work algorithm requires a hash output with 19 leading zeros before a Block is accepted by the network and added to the Bitcoin blockchain: While it's hard to find the right nonce it is easy to reverse the task and verify that the hash is correct as the hash function just has to be run once. To change a block the work has to be redone. Since blocks are chained together by referencing the previous block's hashed header the further back a block in the chain the harder it is to change since all blocks after it would have to be changed as well.

Proof-of-work is essentially one-CPU-one-vote. The majority decision is represented by the longest chain, which has the greatest proof-of-work effort invested in it. If a majority of CPU power is controlled by honest nodes, the honest chain will grow the fastest and outpace any competing chains. To modify a past block, an attacker would have to redo the proof-of-work of the block and all blocks after it and then catch up with and surpass the work of the honest nodes.

Below is a simplified implementation of proof-of-work in Ruby inspired by Haseeb Qureshi's lecture. The script let's you define the diffifculty by specifying the amount of zeros the resulting hash should begin with. It then takes a string, which in our case is "hello world! It will return true when a nonce has been found which appended to the string "hello world!

When the nonce is found the loop stops and returns the nonce which is the number our ProofOfWork algorithm sought.

As we see above it is You can run this code and adjust the difficulty to see how much longer it takes on average to find the right hash. With the nonce and the string we can quickly verify that combined they result in the same right hash. The difficulty of proof-of-work is highlighted when compared to the ease of verification counting how long it took:. Less than 4 seconds doesn't sound like much, but an increased diffulty quickly becomes computationally very expensive to a level where additional hardware is required and energy to power this hardware.

When mining popular Cryptocurrencies finding the right nonce is a competitve race and who finds it first is awarded coins. Cryptocurrencies adjust the difficulty, i. The Hash Power refers to the computation power of the network of all participating miners. Miners run proof-of-work and the nodes in the network verify it. Proof-of-work has been critisized for its energy consumption and alternative solutions are being discussed, most notably Proof of Stake.

Hashing The hashing algorithm SHA which is used by Bitcoin works by taking an input and returning a deterministic output which is unique to its input.