What are bitcoin miners really solving? (collected from web)

in #steemit8 years ago (edited)

What are bitcoin miners really solving?

Here is an extremely simplified sketch of the problem, but it should give a pretty good idea of what the problem is. The data: This is the hash of the lastest block (shortened to 30 characters):  

00000000000001adf44c7d69767585

These are the hashes of a few valid transactions waiting for inclusion (shortened). 

5572eca4dd4
db7d0c0b845

And this the hash of one special transaction that you just crafted, which gives 25BTC (the current reward) to yourself: 

916d849af76

Building the next block: Now, let's use a gross approximation of what a new block might look  like (the real one uses binary format). It contains the hash of the  previous block and the hashes of those 3 transactions: 

00000000000001adf44c7d69767585--5572eca4dd4-db7d0c0b845-916d849af76--

Now let's do mining by hand! Our goal is to complete this block with a  nonce (a piece of garbage) such that the hash of the new block starts  with 13 zeros (considering the previous hash, it seems that 13 zeroes is  the current difficulty!). Mining (trying to finalize this block): Let's try with nonce=1, and compute the hash of the block (I'm using the md5 hash algorithm, but Bitcoin uses double sha256): 

> echo "00000000000001adf44c7d69767585--5572eca4dd4-db7d0c0b845-916d849af76--1" | md5sum 
8b9b994dcf57f8f90194d82e234b72ac

No luck, the hash does not start with a 0… Let's try with nonce=2 

> echo "00000000000001adf44c7d69767585--5572eca4dd4-db7d0c0b845-916d849af76--2" | md5sum 
5b7ce5bcc07a2822f227fcae7792fd90

No luck… … If we pursue until nonce=16, we get our first leading zero. 

> echo "00000000000001adf44c7d69767585--5572eca4dd4-db7d0c0b845-916d849af76--16" | md5sum 
03b80c7a34b060b33dd8fbbece79cee3

For nonce=208, we get two leading zeroes! 

> echo "00000000000001adf44c7d69767585--5572eca4dd4-db7d0c0b845-916d849af76--208" | md5sum 
0055e55df5758517c9bed0981b52ce4a

Continue like this… If you finally find a hash that has 13 leading  zeroes… you're a winner! Other miners will now build upon your block,  you've just got 25BTC. But you'll have to be fast! Back to step 1… If someone manages to build a block before you do, you'll have to  start again from the beginning with the new block's hash (the one of the  winner).  

Sort:  

Hi! This post has a Flesch-Kincaid grade level of 9.5 and reading ease of 81%. This puts the writing level on par with Michael Crichton and Mitt Romney.

Coin Marketplace

STEEM 0.21
TRX 0.25
JST 0.038
BTC 98069.15
ETH 3438.73
USDT 1.00
SBD 3.11