Bitcoin Forum

Other => Beginners & Help => Topic started by: kuloch on June 16, 2011, 07:47:17 AM



Title: Questions on the Mining Process
Post by: kuloch on June 16, 2011, 07:47:17 AM
After spending most of last night and today reading up on BitCoin, I still have a few questions.  Please also correct me where I state something incorrectly.  Pointing me in the direction of good further reading on the subject is just as much appreciated as an answer.

As best I understand the BitCoin mining process:

BitCoin miners work with the existing accepted block chain to create a new block hash.  The new block itself contains recent transactions (since the last validated block?), a random number, and the previous (most recently validated) block's hash.  The new block is hashed until a hash is found that meets the current difficulty standards.  The new block is then published - presumably with its hash and the key required to validate it - in hope that it will be generally validated and yield a BitCoin minting (currently 50 BTC).

Question 1:
If Alice has just created a successful hash and publishes her new block to the network just moments after Bob has published his own block and hash, would the network then (likely) reject Alice's block in favor of Bob's probably already accepted block?

Question 2:
I'm asking this about the "original" BitCoin client at bitcoin.org (http://bitcoin.org), although I expect that all other miners generally do the same.  As the client receives notifications of published blocks and transactions, it presumably uses them in its block hashes? (and stops using "old" information as appropriate?)

Question 3:
I see a couple (http://forum.bitcoin.org/index.php?topic=16932.msg220681#msg220681) posts (http://forum.bitcoin.org/index.php?topic=16932.msg218999#msg218999) mentioning that mining has been removed from the "original" BitCoin client (in 0.3.22 ?).  I am using version 0.3.23-beta.  Does this mean that my client only maintains connection with some peers and downloads/validates publications?  (in addition to providing me with a "wallet" and a means of publishing transactions)

If so, then the only mining I have going on, despite having two "original" clients fired up, is the GUIminer running on my GPU with slush's pool?  (if this is the case, I highly agree that they need to update the main site that claims you're mining with that client; I thought I was until just a bit ago)

More questions are likely to come as I receive clarification.  In part, I'm trying to get a handle on how futile it is to do solo mining.


Title: Re: Questions on the Mining Process
Post by: willphase on June 16, 2011, 09:35:36 AM
After spending most of last night and today reading up on BitCoin, I still have a few questions.  Please also correct me where I state something incorrectly.  Pointing me in the direction of good further reading on the subject is just as much appreciated as an answer.

As best I understand the BitCoin mining process:

BitCoin miners work with the existing accepted block chain to create a new block hash.  The new block itself contains recent transactions (since the last validated block?), a random number, and the previous (most recently validated) block's hash.  The new block is hashed until a hash is found that meets the current difficulty standards.  The new block is then published - presumably with its hash and the key required to validate it - in hope that it will be generally validated and yield a BitCoin minting (currently 50 BTC).

Question 1:
If Alice has just created a successful hash and publishes her new block to the network just moments after Bob has published his own block and hash, would the network then (likely) reject Alice's block in favor of Bob's probably already accepted block?

Question 2:
I'm asking this about the "original" BitCoin client at bitcoin.org (http://bitcoin.org), although I expect that all other miners generally do the same.  As the client receives notifications of published blocks and transactions, it presumably uses them in its block hashes? (and stops using "old" information as appropriate?)

Question 3:
I see a couple (http://forum.bitcoin.org/index.php?topic=16932.msg220681#msg220681) posts (http://forum.bitcoin.org/index.php?topic=16932.msg218999#msg218999) mentioning that mining has been removed from the "original" BitCoin client (in 0.3.22 ?).  I am using version 0.3.23-beta.  Does this mean that my client only maintains connection with some peers and downloads/validates publications?  (in addition to providing me with a "wallet" and a means of publishing transactions)

If so, then the only mining I have going on, despite having two "original" clients fired up, is the GUIminer running on my GPU with slush's pool?  (if this is the case, I highly agree that they need to update the main site that claims you're mining with that client; I thought I was until just a bit ago)

More questions are likely to come as I receive clarification.  In part, I'm trying to get a handle on how futile it is to do solo mining.

1.  both blocks are considered 'equally valid' until another new block is created.  Because this new block has to use the hash from one of the previous blocks (otherwise it's invalid) at the time the new block attaches to one of the two blocks, the chain with the new block now becomes the 'best' chain and clients/miners will start attaching to this chain.

2. Yes

3. Yes - the bitcoin client now just forwards valid blocks/transactions on to other bitcoin clients as part of the p2p network, and does not attempt to generate new blocks.

HTH,

Will


Title: Re: Questions on the Mining Process
Post by: kuloch on June 16, 2011, 09:49:04 AM
1.  both blocks are considered 'equally valid' until another new block is created.  Because this new block has to use the hash from one of the previous blocks (otherwise it's invalid) at the time the new block attaches to one of the two blocks, the chain with the new block now becomes the 'best' chain and clients/miners will start attaching to this chain.

Ah, so they aren't validated simply upon being published, but rather by future publications using them and creating a more difficult (and longer) chain.

So what determines which of multiple branches that a given client will use for the next block?  Is this left up to each client's implementation?  Do they tend to go with the lowest timestamp (assuming that timestamps are recorded), or some other deterministic method?  Or is it stochastic, giving both blocks a "fair" chance?


Title: Re: Questions on the Mining Process
Post by: Meni Rosenfeld on June 16, 2011, 07:09:11 PM
1.  both blocks are considered 'equally valid' until another new block is created.  Because this new block has to use the hash from one of the previous blocks (otherwise it's invalid) at the time the new block attaches to one of the two blocks, the chain with the new block now becomes the 'best' chain and clients/miners will start attaching to this chain.

Ah, so they aren't validated simply upon being published, but rather by future publications using them and creating a more difficult (and longer) chain.

So what determines which of multiple branches that a given client will use for the next block?  Is this left up to each client's implementation?  Do they tend to go with the lowest timestamp (assuming that timestamps are recorded), or some other deterministic method?  Or is it stochastic, giving both blocks a "fair" chance?
The branch representing the highest total difficulty (barring changes in difficulty, this is simply the one with the longest chain of blocks) is chosen to be built upon. In case of a tie, the one the client saw first is chosen.

Note that the client doesn't now try to calculate hashes, but it does provide getwork to miner software.