The nonce is returned if it meets the difficulty.
One of the most common questions about Bitcoin mining. What are they doing? What problem are they attempting to solve? Can it be solved with schrijfstift and paper? Are they wasting resources? Are they using the laptop power to hack something?
The problem being solved involves cryptography. To waterput it simply, a cryptographic cipher turns one string into another string. A ordinary cipher would be multiplying by 6.
The are are problems with using “multiplying 6” spil scheme. The fattest problem is that it is pretty effortless to figure out the original number by just diving by 6! Also, the number will get larger and larger.
To get around this all kinds of complicated mathematical operations are done on very long strings of numbers. It would take a very long explanation of the algorithm used. Below is diagram of one step of one hash. Those things on the right are special mathematical functions that are tedious to calculate and require a pc.
Modern Bitcoin miners can do this problem approximatly 1 billion times a 2nd so it might not be worth while to use vulpen and paper.
You can attempt it yourself at a web webpagina http://www.xorbin.com/devices/sha256-hash-calculator. Waterput ter a value ter the top and you will see a string come up ter the bottom. Then you have to keep switching the input by adding stuff until the reaction starts with a zero.
Bitcoin is more complicated because certain information has to be included, including the hash from the last block. That way the current block depends on all the blocks before it so it is “chained” together which is why it is called the “Blockchain.”. The “difficulty” of the problem is switched by simply enhancing the number of zeros ter the commence of response (0h4fgs64j…, 00h3uyf8h…, 000yheofle… ) so it is firmer to find the response. Spil more people mine, the problem becomes more difficult and the problem adjusts so it is solved every Ten minutes on average.
The Proof of Work (PoW) ideas goes back to a concept called HashCash which wasgoed meant spil a deterrent to spam. The sender vereiste provide a solution to a cryptographic problem before the message will be accepted.
For example, take a cryptographic hash using the SHA256 hashing algorithm of the term “message” (without quotes) and you get:
Now if the rules say you vereiste have a hash that starts with a zero you can begin adding stuff until you get a hash that works:
After going through the numbers sequentially 51 wasgoed the very first one that worked. Spil long spil ”51 is sent along with the message the receiver can quickly verify it meets the requirements by performing the hash and accept the message. The added portion, ter this case”51,” is called a “nonce.”
Bitcoin mining works by compiling the transactions, the value that depends on all previous blocks, and then finding a “nonce” that meets the criteria.
The purpose of solving this problem is merely to voorstelling that work wasgoed done to get the reaction. It comes from a problem called the “Byzantine General’s problem.” You have general who is providing orders to “attack” or “retreat” and he sends those orders to his underlings. Thesis underlings then relay the orders to troops. The problem is that a petite number of underlings are traitors and will relay false orders. Ter order to prevent the traitors from causing catastrophic results an order is not accepted unless it is received from numerous sources. To recreate the false message a traitor would have to do a tremendous amount of work. The purpose of all the reserve work is to prevent the traitors from sending false messages but serves no other purpose.
When the mining a block the Bitcoin mining algorithm works like this:
- A block starts out with a header and a single transaction to pay the miner prize. This transaction has a special name (called the “coinbase”).
- Transactions are added to the block.
- A block “header” of immobilized length is formed by doing cryptographic hashes of the transactions (called the Merkle root).
- Mining uses SHA256 cryptography which cracks the gegevens up into 64 byte chunks and operates on each chunk so there are Two chunks and Two steps to the SHA256 algorithm te this case.
- The very first sha256 step is performed on the very first chunk of the header and that does not switch. This is called the “midstate” because it is partway through the SHA256 process which is Two steps te this case. The “midstate” is sent to the ASIC processor,
- The 2nd step of SHA256 is done on the 2nd chunk of the header. This includes the nonce field. This is done on the Application Specific Integrated Circuit (ASIC) chip.
- The entire solution is run through a 2nd round of SHA256 and the solution compared to the difficulty (that is part of the block header). The nonce is returned if it meets the difficulty. This is done on the ASIC chip.
- The nonce is incremented and the last Two steps (6 and 7) are done again Two**32 times to harass all possible nonce values. This is done on the ASIC chip.
- If no solution is found another nonce contained within the coinbase transaction is incremented. This switches the hash of the coinbase transaction and the merkle root
- The process goes back to step Five and resumes until a solution is found.
Because the chips do Two rounds of SHA256 they cannot be used for other SHA256 tasks that generally only use 1 pass. This means Bitcoin miner ASIC chips cannot be used for anything other than Bitcoin mining.