Author

Topic: Where does it start? (Read 774 times)

donator
Activity: 1218
Merit: 1079
Gerald Davis
November 11, 2013, 07:53:37 PM
#6
Yes.  Given the size of the hash space (2^256) we can drop the "nearly" from the impossible & guaranteed.  The block headers will be unique.  The probability of two unique block headers producing the same has are 1 in 2^256 which for all practical intents in purposes is 0.

There is one additional "field" which is more useful to pools.  The coinbase input field has no use in Bitcoin so it can hold any arbitrary psuedo random value.  This is used by pools as an "extra nonce" field so they can give two wokers different blockheaders despite having the same tx set.  Changing the extra nonce in the coinbase tx will change the tx hash which will change the merkle tree root hash.  This way by incrementing the extra-nonce field a pool can quickly assign unique (but very similar) work to thousands of workers if necessary.
full member
Activity: 126
Merit: 100
November 11, 2013, 07:18:47 PM
#5
If ANY of these values are different the hash will be different.  Miners routinely attempt the same nonce.  Your own individual miners will attempt the same nonce millions of times.  The nonce is only 32 bit, there are only 4 billion possibilities.  A KNC Jupiter for example will exhaust the nonce range in less than 1/100th of a second.  Even a low end GPU will try all possible nonces (for a given blockheader) in a few seconds.

The "hashMerkleRoot" is a unique hash which represents all the transactions in the block.   If you add, remove, or change ONE transaction in the block you will end up with a different Merkle Root hash.  One of those transactions is the "coinbase" where miners receive their reward.  Even two miners (solo miners, pools, p2pool users) which have the exact same set of other transactions will still have a unique coinbase txs and thus have different Merkle Root hashes.

Different Merkle Root Hash = Different Block Header = Different Hash.


https://en.bitcoin.it/wiki/Block_hashing_algorithm
Given just those fields, people would frequently generate the exact same sequence of hashes as each other and the fastest CPU would almost always win. However, it is (nearly) impossible for two people to have the same Merkle root because the first transaction in your block is a generation "sent" to one of your unique Bitcoin addresses. Since your block is different from everyone else's blocks, you are (nearly) guaranteed to produce different hashes. Every hash you calculate has the same chance of winning as every other hash calculated by the network.

This is starting to make sense - thank you
donator
Activity: 1218
Merit: 1079
Gerald Davis
November 11, 2013, 02:34:39 PM
#4
Your example is too crude to provide anything to correct.

First of all if you are mining for a pool you really aren't a "miner" you are a SHA-2 hashpower provider (independent contractor), your pool makes sure there is no duplicate work.  For the purpose of this explanation, only entities which construct the block headers are "miners" (pool operators, solo miners, and some unique situations like p2pool).

No miner is working on the same "work".  You aren't just hashing a single number.  That would be beyond pointless it wouldn't provide any security.  What does the number 123456 hashed mean?  Absolutely nothing.  How would it prevent modifying the blockchain?  It wouldn't.  

You are hashing a blockheader which consists of 6 values only one of which is "the number" which is called a nonce.  The nonce is simply a way to add entropy so you can make multiple tries without changing anything else in the blockheader.

So what is in the blockheader?

Code:
Field	        Purpose	                                                    Updated when
Version        Block version number                                    You upgrade the software and it specifies a new version
hashPrevBlock 256-bit hash of the previous block header            A new block comes in
hashMerkleRoot 256-bit hash based on all of the transactions in the block  A transaction is accepted
Time        Current timestamp as seconds since 1970-01-01T00:00 UTC    Every few seconds
Bits        Current target in compact format                    The difficulty is adjusted
Nonce        32-bit number (starts at 0)                            A hash is tried (increments)
https://en.bitcoin.it/wiki/Block_hashing_algorithm

If ANY of these values are different the hash will be different.  Miners routinely attempt the same nonce.  Your own individual miners will attempt the same nonce millions of times.  The nonce is only 32 bit, there are only 4 billion possibilities.  A KNC Jupiter for example will exhaust the nonce range in less than 1/100th of a second.  Even a low end GPU will try all possible nonces (for a given blockheader) in a few seconds.

The "hashMerkleRoot" is a unique hash which represents all the transactions in the block.   If you add, remove, or change ONE transaction in the block you will end up with a different Merkle Root hash.  One of those transactions is the "coinbase" where miners receive their reward.  Even two miners (solo miners, pools, p2pool users) which have the exact same set of other transactions will still have a unique coinbase txs and thus have different Merkle Root hashes.

Different Merkle Root Hash = Different Block Header = Different Hash.

No two miners on the planet are ever working on the same work (with the exception of a bug in a pool server issuing duplicate work to its workers).
legendary
Activity: 3586
Merit: 1098
Think for yourself
November 11, 2013, 02:16:26 PM
#3
sr. member
Activity: 252
Merit: 250
November 11, 2013, 01:45:14 PM
#2
I'm not even sure how to ask this question so here goes:

The bitcoin mining network is hashing away and pool X finds a block - question:  once a miner sees that a block is solved, how does it know where to start mining the next block?

Example:
- block found
- network notified
- Miner 1 > starts to brute force the next block by trying 1111, 1112, 1113, 1114
- Miner 2 > starts to brute force the new block by trying HuhHuh
- Miner 3 > starts to brute force the new block by trying HuhHuh
- Miner 4 > starts to brute force the new block by trying HuhHuh
- Miner 5 > starts to brute force the new block by trying HuhHuh

What's to keep all 5 miners from starting at the same starting position and therefore (basically) finding the 'solution' at the same time?  Is there some sort of randomization calculator built into the software so the miners all start at a different point??  I mean if I have 5 miners going myself and they are all trying to solve the same problem and they are all starting at the same start position they would all be doing the same work!

I hope this makes sense - sorry for the crude example!


You might want to start here http://codinginmysleep.com/bitcoin-mining-in-plain-english/
full member
Activity: 126
Merit: 100
November 11, 2013, 01:38:16 PM
#1
I'm not even sure how to ask this question so here goes:

The bitcoin mining network is hashing away and pool X finds a block - question:  once a miner sees that a block is solved, how does it know where to start mining the next block?

Example:
- block found
- network notified
- Miner 1 > starts to brute force the next block by trying 1111, 1112, 1113, 1114
- Miner 2 > starts to brute force the new block by trying HuhHuh
- Miner 3 > starts to brute force the new block by trying HuhHuh
- Miner 4 > starts to brute force the new block by trying HuhHuh
- Miner 5 > starts to brute force the new block by trying HuhHuh

What's to keep all 5 miners from starting at the same starting position and therefore (basically) finding the 'solution' at the same time?  Is there some sort of randomization calculator built into the software so the miners all start at a different point??  I mean if I have 5 miners going myself and they are all trying to solve the same problem and they are all starting at the same start position they would all be doing the same work!

I hope this makes sense - sorry for the crude example!
Jump to: