Bitcoin Forum
May 29, 2024, 04:30:46 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2]  All
  Print  
Author Topic: Block generation technical specifics  (Read 1699 times)
busterroni (OP)
Sr. Member
****
Offline Offline

Activity: 277
Merit: 250


View Profile
September 09, 2014, 10:59:08 PM
 #21

I think number of zeros is confusing and is actually not even correct.

Look upon the hash as a big long number.  The target is actually another number.

Mining is this, in a nutshell:

1) Hash the block
2) Is the hash of the block less than the current target (which is just a number set by the protocol about every two weeks)
3) If yes you win, broadcast your result collect your 25 BTC
4) If no then modify the block so you will get a different result when you calculate the hash, go to step 1)

Do steps 1-4 as fast as you possibly can.
 

U actually omit the part of explaining what 'Hash the block' means, which is part of jackjack's explanation.

By the way, is there any known function to adjust the nonce to get a lower hash ?
No, that's the point of hashing functions: the output can't be predicted.


Quote
I get that you're trying to make it simpler, but I really wanna know the way it's done correctly. Even if it's confusing.
Well, the process is literally what I described. Just with bigger numbers.
Let's say the current target is 000...0004c7b (with enough zeroes replacing the "..." to have 64 characters)
Then the accepted hashes for the next block will be all the hashes inferior to this target.
ie 0...004c7a, 0...004c79, 0...004c78, etc, 0...004c70, 0...004c6f, etc, 0...000000.
Oh, I thought the only characters that mattered were the beginning zeroes. I think I get it now. Just making sure, numbers are 'less than' letters right? ie if '000aaa' is the target, '000aa9' would work. If '000999' were the target, '00099a' wouldn't work. Right?
busterroni (OP)
Sr. Member
****
Offline Offline

Activity: 277
Merit: 250


View Profile
September 09, 2014, 11:01:55 PM
 #22

How can there be a tie if the first one to get a hash less than the difficulty wins?
Bitcoin does not use a world wide clock to tell who wins.  Two miners can get hashes that are both less than the target at more or less the same time.  They both can claim the 25 BTC at more or less the same time.  If one miner is on one side of the planet and the other one is on the other side of the planet then parts of the network will agree with miner one and parts of the network will agree with miner two.  So the conflict gets resolved but not by using a clock - because that would not work.

Once the conflict is resolved by all the nodes on the system one of the two blocks get accepted by everyone and the other one is thrown out.  The miner that gets accepted by everyone gets the block reward and fees.  The other miner gets the shaft, what we call an orphaned block.  This happens all the time.
I think I understand what you're saying but one question:

On blockchain.info it shows all of the discovered blocks. If one block is solved by two miners, will the block show up twice? Or will blockchain.info wait until the next block is solved so it sees which one was accepted?
BurtW
Legendary
*
Offline Offline

Activity: 2646
Merit: 1136

All paid signature campaigns should be banned.


View Profile WWW
September 09, 2014, 11:04:18 PM
 #23

In fact blockchain.info will show both of the blocks until the conflict gets resolved, even then you can still see the orphaned blocks.  You can go check out all the orphaned blocks right now on their web site.  They also keep statistics on how often blocks get orphaned:

https://blockchain.info/charts/n-orphaned-blocks?timespan=180days&showDataPoints=false&daysAverageString=1&show_header=true&scale=0&address=

Our family was terrorized by Homeland Security.  Read all about it here:  http://www.jmwagner.com/ and http://www.burtw.com/  Any donations to help us recover from the $300,000 in legal fees and forced donations to the Federal Asset Forfeiture slush fund are greatly appreciated!
BitCoinDream
Legendary
*
Offline Offline

Activity: 2338
Merit: 1204

The revolution will be digital


View Profile
September 09, 2014, 11:08:23 PM
 #24

In fact blockchain.info will show both of the blocks until the conflict gets resolved, even then you can still see the orphaned blocks.  You can go check out all the orphaned blocks right now on their web site.  They also keep statistics on how often blocks get orphaned:

https://blockchain.info/charts/n-orphaned-blocks?timespan=180days&showDataPoints=false&daysAverageString=1&show_header=true&scale=0&address=

How this conflict gets resolved ? Who has the lower hash among the 2 or more hashes below target becomes the ultimate winner to get 25 BTC + Miner fee ? If not, then what is the mechanism to break the tie ?

busterroni (OP)
Sr. Member
****
Offline Offline

Activity: 277
Merit: 250


View Profile
September 09, 2014, 11:10:25 PM
 #25

In fact blockchain.info will show both of the blocks until the conflict gets resolved, even then you can still see the orphaned blocks.  You can go check out all the orphaned blocks right now on their web site.  They also keep statistics on how often blocks get orphaned.
Awesome, I get it now, thanks Smiley

Would the conflict blocks count as two confirmations? Logically it seems like it would only count as one.

Wait, as I was typing this I thought of something else Tongue I don't understand how they could be solved at the same time. As soon as the block is solved by one miner, it's broadcasted within a fraction of a second of being solved (right?). As soon as it's broadcasted, all miners receive the message that it was solved and start solving a new hash. This should all happen in less than a second I think. What are the odds that two miners solve the same block in less than a second?

I understand that you said it's not like a clock, so the first one to solve it doesn't necessarily win – but as soon as all of the miners realize that the block was solved, why would they continue on the same block?
busterroni (OP)
Sr. Member
****
Offline Offline

Activity: 277
Merit: 250


View Profile
September 09, 2014, 11:11:58 PM
 #26

In fact blockchain.info will show both of the blocks until the conflict gets resolved, even then you can still see the orphaned blocks.  You can go check out all the orphaned blocks right now on their web site.  They also keep statistics on how often blocks get orphaned:

https://blockchain.info/charts/n-orphaned-blocks?timespan=180days&showDataPoints=false&daysAverageString=1&show_header=true&scale=0&address=

How this conflict gets resolved ? Who has the lower hash among the 2 or more hashes below target becomes the ultimate winner to get 25 BTC + Miner fee ? If not, then what is the mechanism to break the tie ?
From what I understand, it gets resolved by the next block that's mined – there's two hashes to be solved (one for each conflict block), and depending on which one gets solved, that's the block that wins. Can someone confirm this?

Nevermind^^, I think it's just based on which block the nodes agree upon. I'm not sure how the nodes decide which block, however. Can someone confirm this? Tongue
BurtW
Legendary
*
Offline Offline

Activity: 2646
Merit: 1136

All paid signature campaigns should be banned.


View Profile WWW
September 09, 2014, 11:15:48 PM
 #27

I was off trying to get the link for the orphaned blocks for you.  The link is:

https://blockchain.info/orphaned-blocks

But it appears to be broken right now.  You can probably see them through another block explorer - there are many others.

I have to go but someone else can explain the conflict resolution OR it may be time for you to just bite the bullet and read Satoshi's paper.  From what you have written and understood so far you can read it and understand it.  It is not that long and it is not that difficult.  Give it a try.

Our family was terrorized by Homeland Security.  Read all about it here:  http://www.jmwagner.com/ and http://www.burtw.com/  Any donations to help us recover from the $300,000 in legal fees and forced donations to the Federal Asset Forfeiture slush fund are greatly appreciated!
BitCoinDream
Legendary
*
Offline Offline

Activity: 2338
Merit: 1204

The revolution will be digital


View Profile
September 09, 2014, 11:15:56 PM
 #28

I think number of zeros is confusing and is actually not even correct.

Look upon the hash as a big long number.  The target is actually another number.

Mining is this, in a nutshell:

1) Hash the block
2) Is the hash of the block less than the current target (which is just a number set by the protocol about every two weeks)
3) If yes you win, broadcast your result collect your 25 BTC
4) If no then modify the block so you will get a different result when you calculate the hash, go to step 1)

Do steps 1-4 as fast as you possibly can.
 

U actually omit the part of explaining what 'Hash the block' means, which is part of jackjack's explanation.

By the way, is there any known function to adjust the nonce to get a lower hash ?
No, that's the point of hashing functions: the output can't be predicted.


Quote
I get that you're trying to make it simpler, but I really wanna know the way it's done correctly. Even if it's confusing.
Well, the process is literally what I described. Just with bigger numbers.
Let's say the current target is 000...0004c7b (with enough zeroes replacing the "..." to have 64 characters)
Then the accepted hashes for the next block will be all the hashes inferior to this target.
ie 0...004c7a, 0...004c79, 0...004c78, etc, 0...004c70, 0...004c6f, etc, 0...000000.
Oh, I thought the only characters that mattered were the beginning zeroes. I think I get it now. Just making sure, numbers are 'less than' letters right? ie if '000aaa' is the target, '000aa9' would work. If '000999' were the target, '00099a' wouldn't work. Right?

Hashes actually use Hexadecimal no. system, which consists of 16 base values 0-f instead of 0-9 of decimal no. system. The base values are as follows => 0 1 2 3 4 5 6 7 8 9 a b c d e f

busterroni (OP)
Sr. Member
****
Offline Offline

Activity: 277
Merit: 250


View Profile
September 09, 2014, 11:24:50 PM
 #29

I was off trying to get the link for the orphaned blocks for you.  The link is:

https://blockchain.info/orphaned-blocks

But it appears to be broken right now.  You can probably see them through another block explorer - there are many others.

I have to go but someone else can explain the conflict resolution OR it may be time for you to just bite the bullet and read Satoshi's paper.  From what you have written and understood so far you can read it and understand it.  It is not that long and it is not that difficult.  Give it a try.
I was actually planning on reading that, I printed it out last night Smiley

Now that I'm moving onto moar technical aspects of bitcoin I need to read it. Thanks a lot bud.
busterroni (OP)
Sr. Member
****
Offline Offline

Activity: 277
Merit: 250


View Profile
September 09, 2014, 11:27:50 PM
 #30

Oh, I thought the only characters that mattered were the beginning zeroes. I think I get it now. Just making sure, numbers are 'less than' letters right? ie if '000aaa' is the target, '000aa9' would work. If '000999' were the target, '00099a' wouldn't work. Right?

Hashes actually use Hexadecimal no. system, which consists of 16 base values 0-f instead of 0-9 of decimal no. system. The base values are as follows => 0 1 2 3 4 5 6 7 8 9 a b c d e f
Ah, ok, thanks Smiley
busterroni (OP)
Sr. Member
****
Offline Offline

Activity: 277
Merit: 250


View Profile
September 10, 2014, 03:53:56 PM
 #31

Can you guys tell me if this is correct? If there's even a small error please point it out, this has to be 100% accurate. Note that this text is owned by me and do not use it anywhere else for neither commercial nor personal use without asking me for permission first. Thanks.

What a miner is doing when it's running is generating millions of hashes every second. A hash looks something like 00000000000000000b8cd4a8a7752ff8785f66232359273f619f6a6cb28d4644.
A hash is always 64 characters long. Each block has a 'target' hash, which looks similar to the string of characters above. When the hash that your miner generates has a lower value than the target hash, you win the block. An example with smaller numbers would be a target hash of 0007b5 (note that this isn't an actual hash for bitcoin as it isn't 64 characters long, this is just an example). If your miner generates the hash 0007<strong>a</strong>5, you win the block. However, if it generates the hash 0007<strong>c</strong>5, you don't win the block. The order of the 'value' of the characters from lowest to highest value are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f.
As the difficulty increases, the 'value' of the target hash becomes lower, as more zeroes are added on to the beginning. This makes it harder for your miner's hash to have a lesser value than the target hash, so it gets harder to win the block. Notice how the example target hash above had 17 zeroes at the beginning, while the target hash of <a href="https://blockchain.info/block-index/14849">the first ever mined block</a> had only 10 zeroes at the beginning.
Pages: « 1 [2]  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!