Bitcoin Forum
May 09, 2024, 11:31:36 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2]  All
  Print  
Author Topic: When you start working on a block, why others won't do same thing?  (Read 3712 times)
commlinx
Full Member
***
Offline Offline

Activity: 294
Merit: 100



View Profile
May 27, 2011, 07:28:25 AM
 #21

I wondered about this too a while ago, I think the OP is wondering why if we sit down with identical hardware and start our PCs at the same time why we wouldn't be doing exactly the same work, because if we're using the same mining software it'd be trying the hashes in the same order.

The thing that gives it a random element is that the receiving address is part of the hash. When you press generate coins in the official client (when it was there) each thread gets a new receiving address from your pool of addresses. Then if it solves the block first it allocates the key and you get your shiny new 50BTC allocated against that receiving address that nobody else has. So in a sense we're doing the same thing, but my solution will be different to yours, and there's a high probability we'll find them at different times. And on your PC each has a different address so the same applies to them as well, so they're not really working against each other.

I've never looked but I assume pooled mining does a similar thing and send each client an address from their pool?
1715297496
Hero Member
*
Offline Offline

Posts: 1715297496

View Profile Personal Message (Offline)

Ignore
1715297496
Reply with quote  #2

1715297496
Report to moderator
1715297496
Hero Member
*
Offline Offline

Posts: 1715297496

View Profile Personal Message (Offline)

Ignore
1715297496
Reply with quote  #2

1715297496
Report to moderator
1715297496
Hero Member
*
Offline Offline

Posts: 1715297496

View Profile Personal Message (Offline)

Ignore
1715297496
Reply with quote  #2

1715297496
Report to moderator
Be very wary of relying on JavaScript for security on crypto sites. The site can change the JavaScript at any time unless you take unusual precautions, and browsers are not generally known for their airtight security.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715297496
Hero Member
*
Offline Offline

Posts: 1715297496

View Profile Personal Message (Offline)

Ignore
1715297496
Reply with quote  #2

1715297496
Report to moderator
1715297496
Hero Member
*
Offline Offline

Posts: 1715297496

View Profile Personal Message (Offline)

Ignore
1715297496
Reply with quote  #2

1715297496
Report to moderator
PRCman (OP)
Newbie
*
Offline Offline

Activity: 42
Merit: 0


View Profile
May 27, 2011, 07:41:35 AM
 #22

I don't understand, why in computing period, there is no compation, won't 2 miners caculate several same has values while they are mining?

You misunderstand because you think there is some sort of extended work involved in finding a valid hash. There isn't. Each hash attempt takes something like 2-3 billionths of a second, and either succeeds or fails immediately.

As others said, it's like rolling a die over and over again until you get a 1. Only instead of the die having six sides it has 1.8 trillion. A difficulty increase is like adding more sides to the die. If you can roll the die faster you can get 1 more often, but other players/miners don't help or hinder you in this.

so each miner has different has values , there is not two miners caculates same has value?
kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1025



View Profile
May 27, 2011, 07:42:21 AM
 #23

kjj, I have two questions about the situation you're describing:

1.) So if two blocks are found at the same time, on opposite sides of the world, you're saying eventually when it all settles down, one person is going to lose their 50btc?

       (also what do you mean by "will be put back into the pool?" )


2.) I completely understand why with the current extreme difficulty this rarely happens, however back when the difficulty was much easier, and GPU miners had just came out so people were hitting jackpots all the time, would you say this happened much more often back then?

1) Yes.  That is actually the reason that no node accepts a coinbase transaction as an input until it has been in the chain for 100 blocks.

As for your parenthetical question, let me back up and answer PRCman first.

wait, so If I have 2 cards in my computer, working as 2 separate workers, are they basically competing against each other? That is, are they doing the exact calculations at the exact same time, or will they be doing different/random calculations in an attempt to find the block?
There's no competition in the sense you're thinking. Within one difficulty period, your mining will result in the same number of bitcoins regardless of whether there are 1 or 10,000,000 other miners on the network.

Mining is competitive only because the network periodically adjusts itself by increasing the difficulty of the hashing work to be done, based on how quickly it has been done in the past. The more miners there are, the faster the work will get done. The faster the work gets done, the harder it will become in the future.

I don't understand, why in computing period, there is no compation, won't 2 miners caculate several same has values while they are mining?

This is a key concept that you must understand:  There is not one true next block that everyone is working on.  Each miner is allowed to create their own block, including their own coinbase transaction, and their own subsets of pending transactions that they wish to include in it.  Each miner is working on their own version of the next block.

The nodes communicate transactions amongst themselves.  Each one can make their own decision as to which ones are included in the block they are working on.  This is where the transaction fee comes in, in case you've been wondering about that little detail.  It doesn't come up much now, because generally each block contains all or most outstanding transactions in the global pool, but that isn't necessary.  Different nodes can pick different ones.

Say there are 7 transactions pending when block A is completed, numbered 1 to 7.  Say the node that creates block B includes transactions 1-5 in the new block, and the node that creates transaction X includes 1-3, and 7 in their new block.  When blocks B and X are done, the nodes will have different ideas of which transactions are done, and which ones are still pending.  The node working on B will think that transactions # 6 and #7 need to be put into the next next block (block C), while the X node thinks that transactions #4, #5 and #6 are still outstanding.

When block "C" comes around, the X node then rolls back all transactions, #1, #2, #3, and #7.  But the new chain includes #1, #2, and #3, so it can discard them.  It also contains #7, so it can discard that one too.  And now it re-broadcasts transactions #4, #5 and #6 as valid transactions.  The rest of the netowrk will pick them up (but probably knew them already) and work at including them in the next next next block.

As for question 2) from PcChip, I wasn't around back then, but the answer is no.  The validity of a block is based on the difficulty of that block.  If the earlier blocks were easier, it was because there was less computational power being applied to the system back then, so it balances out.  The odds of a block race are the same now (give or take a bunch for difficulty lag) as they were back then.

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
PRCman (OP)
Newbie
*
Offline Offline

Activity: 42
Merit: 0


View Profile
May 27, 2011, 07:55:51 AM
 #24

kjj, I have two questions about the situation you're describing:

1.) So if two blocks are found at the same time, on opposite sides of the world, you're saying eventually when it all settles down, one person is going to lose their 50btc?

       (also what do you mean by "will be put back into the pool?" )


2.) I completely understand why with the current extreme difficulty this rarely happens, however back when the difficulty was much easier, and GPU miners had just came out so people were hitting jackpots all the time, would you say this happened much more often back then?

1) Yes.  That is actually the reason that no node accepts a coinbase transaction as an input until it has been in the chain for 100 blocks.

As for your parenthetical question, let me back up and answer PRCman first.

wait, so If I have 2 cards in my computer, working as 2 separate workers, are they basically competing against each other? That is, are they doing the exact calculations at the exact same time, or will they be doing different/random calculations in an attempt to find the block?
There's no competition in the sense you're thinking. Within one difficulty period, your mining will result in the same number of bitcoins regardless of whether there are 1 or 10,000,000 other miners on the network.

Mining is competitive only because the network periodically adjusts itself by increasing the difficulty of the hashing work to be done, based on how quickly it has been done in the past. The more miners there are, the faster the work will get done. The faster the work gets done, the harder it will become in the future.

I don't understand, why in computing period, there is no compation, won't 2 miners caculate several same has values while they are mining?

This is a key concept that you must understand:  There is not one true next block that everyone is working on.  Each miner is allowed to create their own block, including their own coinbase transaction, and their own subsets of pending transactions that they wish to include in it.  Each miner is working on their own version of the next block.

The nodes communicate transactions amongst themselves.  Each one can make their own decision as to which ones are included in the block they are working on.  This is where the transaction fee comes in, in case you've been wondering about that little detail.  It doesn't come up much now, because generally each block contains all or most outstanding transactions in the global pool, but that isn't necessary.  Different nodes can pick different ones.

Say there are 7 transactions pending when block A is completed, numbered 1 to 7.  Say the node that creates block B includes transactions 1-5 in the new block, and the node that creates transaction X includes 1-3, and 7 in their new block.  When blocks B and X are done, the nodes will have different ideas of which transactions are done, and which ones are still pending.  The node working on B will think that transactions # 6 and #7 need to be put into the next next block (block C), while the X node thinks that transactions #4, #5 and #6 are still outstanding.

When block "C" comes around, the X node then rolls back all transactions, #1, #2, #3, and #7.  But the new chain includes #1, #2, and #3, so it can discard them.  It also contains #7, so it can discard that one too.  And now it re-broadcasts transactions #4, #5 and #6 as valid transactions.  The rest of the netowrk will pick them up (but probably knew them already) and work at including them in the next next next block.

As for question 2) from PcChip, I wasn't around back then, but the answer is no.  The validity of a block is based on the difficulty of that block.  If the earlier blocks were easier, it was because there was less computational power being applied to the system back then, so it balances out.  The odds of a block race are the same now (give or take a bunch for difficulty lag) as they were back then.


Quote
This is a key concept that you must understand:  There is not one true next block that everyone is working on.  Each miner is allowed to create their own block, including their own coinbase transaction, and their own subsets of pending transactions that they wish to include in it.  Each miner is working on their own version of the next block.

So why we can't mining without network connection, if next bock is unique, we just need to submit the result to internet when next block is done caculation
Is that true? and it often take more then a month ( difficult may changes durring caculation, what will happen if you don't join a pool and difficult changes durring you caculation on one block?)


kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1025



View Profile
May 27, 2011, 07:59:46 AM
 #25

So why we can't mining without network connection, if next bock is unique, we just need to submit the result to internet when next block is done caculation
Is that true? and it often take more then a month ( difficult may changes durring caculation, what will happen if you don't join a pool and difficult changes durring you caculation on one block?)

Because each block contains the header of the previous block.  Right now we are on block # 127114.  No one cares if you come up with an acceptable replacement for block # 123000, which is what you'd get if you spent a month mining disconnected.  We've moved on.  We don't care any more.

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
PRCman (OP)
Newbie
*
Offline Offline

Activity: 42
Merit: 0


View Profile
May 27, 2011, 08:35:52 AM
 #26

So why we can't mining without network connection, if next bock is unique, we just need to submit the result to internet when next block is done caculation
Is that true? and it often take more then a month ( difficult may changes durring caculation, what will happen if you don't join a pool and difficult changes durring you caculation on one block?)

Because each block contains the header of the previous block.  Right now we are on block # 127114.  No one cares if you come up with an acceptable replacement for block # 123000, which is what you'd get if you spent a month mining disconnected.  We've moved on.  We don't care any more.

The calculation effort between last block # is done, and I got noticed it's done is just a waste, and these things happens every 10 minutes, right?
commlinx
Full Member
***
Offline Offline

Activity: 294
Merit: 100



View Profile
May 27, 2011, 08:50:25 AM
 #27

So why we can't mining without network connection, if next bock is unique, we just need to submit the result to internet when next block is done caculation
Is that true? and it often take more then a month ( difficult may changes durring caculation, what will happen if you don't join a pool and difficult changes durring you caculation on one block?)

Because each block contains the header of the previous block.  Right now we are on block # 127114.  No one cares if you come up with an acceptable replacement for block # 123000, which is what you'd get if you spent a month mining disconnected.  We've moved on.  We don't care any more.

The calculation effort between last block # is done, and I got noticed it's done is just a waste, and these things happens every 10 minutes, right?
Yes in offline mode it would be a waste. When online such things happen so quickly it's quite minimal.
PRCman (OP)
Newbie
*
Offline Offline

Activity: 42
Merit: 0


View Profile
May 27, 2011, 09:03:46 AM
 #28

So why we can't mining without network connection, if next bock is unique, we just need to submit the result to internet when next block is done caculation
Is that true? and it often take more then a month ( difficult may changes durring caculation, what will happen if you don't join a pool and difficult changes durring you caculation on one block?)

Because each block contains the header of the previous block.  Right now we are on block # 127114.  No one cares if you come up with an acceptable replacement for block # 123000, which is what you'd get if you spent a month mining disconnected.  We've moved on.  We don't care any more.

The calculation effort between last block # is done, and I got noticed it's done is just a waste, and these things happens every 10 minutes, right?
Yes in offline mode it would be a waste. When online such things happen so quickly it's quite minimal.


What if someone try to attack the Bitcoin network, gives wrong information about next block #, ex next bolck #should be 130000, they tell them, it's 130100 now, please continue work on 130100!

then all miners are going to waste there calculation effort.
commlinx
Full Member
***
Offline Offline

Activity: 294
Merit: 100



View Profile
May 27, 2011, 09:16:23 AM
 #29

What if someone try to attack the Bitcoin network, gives wrong information about next block #, ex next bolck #should be 130000, they tell them, it's 130100 now, please continue work on 130100!

then all miners are going to waste there calculation effort.
There's a chain to previous blocks that needs to be validated, ie. hash checks pass, it's not just some "next block number" that gets passed around the network. It's a newly created block, and trying to skip numbers would cause your block to not be accepted.
xenon481
Sr. Member
****
Offline Offline

Activity: 406
Merit: 250



View Profile
May 27, 2011, 12:35:56 PM
 #30

I don't understand, why in computing period, there is no compation, won't 2 miners caculate several same has values while they are mining?

It's not just that a given hash value wins, it is that a given hash value wins for the particular block data that you are working on. The block data that you are trying to hash is unique to your miner. No other miner is ever working with the same block data that you are.

Tips Appreciated: 171TQ2wJg7bxj2q68VNibU75YZB22b7ZDr
commlinx
Full Member
***
Offline Offline

Activity: 294
Merit: 100



View Profile
May 27, 2011, 01:13:42 PM
 #31

I don't understand, why in computing period, there is no compation, won't 2 miners caculate several same has values while they are mining?
It's not just that a given hash value wins, it is that a given hash value wins for the particular block data that you are working on. The block data that you are trying to hash is unique to your miner. No other miner is ever working with the same block data that you are.
Is my understanding as posted above that the point of difference between individual miners is the receiving address is different correct? Or are there a few other things in addition that also alter the hash of the block during the generation phase? It's just I'm a relative n00b myself but thought assuming that's technically correct it's a pretty easy to understand answer to these questions. It explains the random element and why two workers aren't doing exactly the same thing because they're solving blocks for different receiving addresses.
xenon481
Sr. Member
****
Offline Offline

Activity: 406
Merit: 250



View Profile
May 27, 2011, 01:29:50 PM
 #32

I don't understand, why in computing period, there is no compation, won't 2 miners caculate several same has values while they are mining?
It's not just that a given hash value wins, it is that a given hash value wins for the particular block data that you are working on. The block data that you are trying to hash is unique to your miner. No other miner is ever working with the same block data that you are.
Is my understanding as posted above that the point of difference between individual miners is the receiving address is different correct? Or are there a few other things in addition that also alter the hash of the block during the generation phase? It's just I'm a relative n00b myself but thought assuming that's technically correct it's a pretty easy to understand answer to these questions. It explains the random element and why two workers aren't doing exactly the same thing because they're solving blocks for different receiving addresses.

There are quite a number of things that are different. But yes, for solo the key difference between solo miners is that they are all trying to create blocks with different receiving addresses for the 50BTC generation payment. But, even if you have multiple machines working solo against a single instance of bitcoind, they are still working on unique work due to the ExtraNonce being different among them.

Tips Appreciated: 171TQ2wJg7bxj2q68VNibU75YZB22b7ZDr
goatpig
Legendary
*
Offline Offline

Activity: 3668
Merit: 1347

Armory Developer


View Profile
May 27, 2011, 01:31:07 PM
 #33

I don't understand, why in computing period, there is no compation, won't 2 miners caculate several same has values while they are mining?
It's not just that a given hash value wins, it is that a given hash value wins for the particular block data that you are working on. The block data that you are trying to hash is unique to your miner. No other miner is ever working with the same block data that you are.
Is my understanding as posted above that the point of difference between individual miners is the receiving address is different correct? Or are there a few other things in addition that also alter the hash of the block during the generation phase? It's just I'm a relative n00b myself but thought assuming that's technically correct it's a pretty easy to understand answer to these questions. It explains the random element and why two workers aren't doing exactly the same thing because they're solving blocks for different receiving addresses.

The main differences between block headers going from a miner to the other are:

1) Coinbase transaction address (the address you submit to receive the 50BTC reward IF you hit the jackpot)
2) Included transactions. There are no rules whatsoever regarding this. As a miner you can integrate any transaction that you wish, even fake, corrupt or non standard ones. This is why the network can be attacked by someone with alot of processing power, because he can add in transactions for coins he already spent, as long as he gets to solve a block.
3) Timestamps. The global time accessible on the network isn't precise. You have to add a timestamp to your block header, and this one is a median of time values recovered from neighbor nodes which need to be within 70 minutes of each other to be considered valid.
4) Client version. Some people don't like to update heh.

commlinx
Full Member
***
Offline Offline

Activity: 294
Merit: 100



View Profile
May 27, 2011, 02:37:14 PM
 #34

1) Coinbase transaction address (the address you submit to receive the 50BTC reward IF you hit the jackpot)
2) Included transactions. There are no rules whatsoever regarding this. As a miner you can integrate any transaction that you wish, even fake, corrupt or non standard ones. This is why the network can be attacked by someone with alot of processing power, because he can add in transactions for coins he already spent, as long as he gets to solve a block.
3) Timestamps. The global time accessible on the network isn't precise. You have to add a timestamp to your block header, and this one is a median of time values recovered from neighbor nodes which need to be within 70 minutes of each other to be considered valid.
4) Client version. Some people don't like to update heh.
Thanks goatpig. Am I right though that 2-4 above are added after the event when you submit your block? For example client would be static and the timestamp would be invalid if the block wasn't solved for over an hour odd if it was part of the initial work. Not trying to be a knob (to use some Aussie slang), just wondering if my original statement that the difference between what different miners are doing mainly (entirely?) depends on the receiving address is correct or not?

Edit - xenon481 has explained more above that I skipped, I'll check back in when a little more sober  Smiley
goatpig
Legendary
*
Offline Offline

Activity: 3668
Merit: 1347

Armory Developer


View Profile
May 27, 2011, 03:15:09 PM
 #35

Thanks goatpig. Am I right though that 2-4 above are added after the event when you submit your block? For example client would be static and the timestamp would be invalid if the block wasn't solved for over an hour odd if it was part of the initial work. Not trying to be a knob (to use some Aussie slang), just wondering if my original statement that the difference between what different miners are doing mainly (entirely?) depends on the receiving address is correct or not?

Edit - xenon481 has explained more above that I skipped, I'll check back in when a little more sober  Smiley

Client version is static indeed. I don't expect to see people turn off their miner, updating their bitcoind or custom miner, and starting to mine, repeating this action several times a minute.

Quote
Am I right though that 2-4 above are added after the event when you submit your block

I'm not sure I understand the question properly. If you are saying that transactions and such are added added after the block header is hashed, then you are mistaken.

The header is built first, then hashed. To build the header you need:

1) current version
2) the hash from the previous block (same for every one)
3) the merkle root. It is a 256 bit hash of the transaction list (including the coinbased transaction) that you are adding to the block. As such, you need to pick the transactions you want to integrate before you can attempt to solve the block
4) time stamp. I haven't looked at that part of the code so don't quote me on this but I read somewhere that this one is updated every few seconds or so by bitcoind. If you are using a custom miner, you may very well not update that part quite as often. Although there is no guarantee a given block header has a solution for the outstanding difficulty, and I don't think you can keep on adding extra nonces, so eventually, you'd have to update the timestamp to get a new header, knowing that a 5870 can perform the 2^32 possible nonce's for a given header in about 10 secondes.
5) the current target. Extracted from difficulty, that is static across the network too.
6) the nonce, a random 32bit integer value that you keep incrementing until you reach 2^32 possibilities. You can randomize work with the nonce as well, by feeding your workers different starting nonce.

The coinbase address is more of a way to differentiate you on the network rather than on the mining side. The avalanche effect makes sure that even a single bit of difference in your header will result in completely different hashes. I hope this is the answer you were looking for.

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!