Author

Topic: what do you think about bitcoin hashing function? (Read 2243 times)

sr. member
Activity: 441
Merit: 268
3. Collect new transactions in a new merkle tree (this can be done in parallel to iterating a nonce, so new merkle tree is immediately available when starting from 0). I'm talking about transactions that arrived after you started iterating.

This is being done after X iterations anyway. And X is much smaller than 2^32 so nonce does not overflow.
legendary
Activity: 1750
Merit: 1007
Solo Mining
========
Solo mining with bitcoind and getwork requires the miner to have bitcoind do any extra legwork (as far as I'm aware).
Solo mining with bitcoind and GBT (I believe is possible) will have the miner editing the extranonce field in the coinbase to create a new merkletree, which gives another 32 bits of nonce space each iteration.
Solo miners can also use a pool server that supports stratum/GBT locally.


Pool Mining
========
Pool mining with GBT or Stratum allow the miner to edit the coinbase with extranonce data to create a new merkletree.  All current miners support this, only the ones that haven't been updated in the last 7 months do not.  They are also able to update nTime as well.

Most stratum pools use a 4-byte ExtraNonce at this time.  This gives 2^64 instead of 2^32 worth of nonce space, not including nTime, which is also by default a part of the stratum (and I believe GBT) protocols.  This means you have 64 bits of nonce space per second (assuming you don't increase nTime faster than real-time).  We are a LONG way from miners able to exhaust that amount of nonce per second.  Additionally, Stratum's ExtraNonce size is a parameter passed during the connection process.  It can be increased much larger assuming the miner software properly implemented the protocol.
donator
Activity: 1218
Merit: 1079
Gerald Davis
What OP is saying is that the higher the difficulty gets, the more likely a block after looping through all the possible nonce space will not have one that matches the difficulty. A dumb miner would keep repeating that loop and never ever find a block, a smart one would change some other part of the block like extraNonce.

Thanks for the clarification, that's exactly what I meant. And I beleive all mining software needs to be **IMPROVED** such that multi-process or multi-thread distributed on different CPU cores can be mining parallel such that:

For simplest case, if only use nonce and no extraNonce or timestamp change etc,
1. mining process 1 mines [0,2^32/N] of the nonce range
2. mining process 2 mines [2^32/N, 2*(2^32/N)] of the nonce range
3. mining process 3 mines [2*(2^32/N), 3*(2^32/N)] of the nonce range
... ...
N. mining process N mines [(N-1)*(2^32/N), N*(2^32/N)] of the nonce range

You could do that or you could just do
process 1: extra nonce n, nonce 0 to 2^32
process 2: extra nonce n+1, nonce: 0 to 2^32
process 3: extra nonce n, nonce 0 to 2^32
process 4: extra nonce n+1, nonce: 0 to 2^32

Neither method is any more efficient than the other one.  Neither method is going to find blocks any faster.  In the long run no matter how you change the block header you are only going to find one block solution for every (difficulty)*(2^32).
donator
Activity: 1218
Merit: 1079
Gerald Davis
Any mining software or ASIC uses the extraNounce to mine?
AFAIK no available mining software even uses extraNonce yet... so ASICs and current GPUs aren't doing it either.

Ever miner back to the 0.1 reference client uses extraNonce.  ExtraNonce is simply a value in the coinbase.  You can put anything in there you want, you could put random values there but all miners put a numeric value and then increment it every time the nonce overflows.  In hindsight it would have made sense to just make nonce a 64 bit value, but that isn't going to change now.


What OP is saying is that the higher the difficulty gets, the more likely a block after looping through all the possible nonce space will not have one that matches the difficulty. A dumb miner would keep repeating that loop and never ever find a block, a smart one would change some other part of the block like extraNonce.

Well by that categorization every single miner that has ever existed (even the basic internal miner in the v0.1 reference client) is "smart" and no miner has every existed (and likely never will exist) which is "dumb".  Not a very useful categorization,  I think the OP is trying to solve a problem which doesn't exist.
hero member
Activity: 572
Merit: 506
And I beleive all mining software needs to be **IMPROVED** such that multi-process or multi-thread distributed on different CPU cores can be mining parallel such that:
Have you already reinvented bicycle?
full member
Activity: 200
Merit: 104
Software design and user experience.
Options when nonce overflows:

1. Change extraNonce.
2. Change reward address.
3. Collect new transactions in a new merkle tree (this can be done in parallel to iterating a nonce, so new merkle tree is immediately available when starting from 0). I'm talking about transactions that arrived after you started iterating.
4. Shake your mining box.  Maybe it'll help.
member
Activity: 98
Merit: 10
Invest NASDAQ in Bitcoin
What OP is saying is that the higher the difficulty gets, the more likely a block after looping through all the possible nonce space will not have one that matches the difficulty. A dumb miner would keep repeating that loop and never ever find a block, a smart one would change some other part of the block like extraNonce.

Thanks for the clarification, that's exactly what I meant. And I beleive all mining software needs to be **IMPROVED** such that multi-process or multi-thread distributed on different CPU cores can be mining parallel such that:

For simplest case, if only use nonce and no extraNonce or timestamp change etc,
1. mining process 1 mines [0,2^32/N] of the nonce range
2. mining process 2 mines [2^32/N, 2*(2^32/N)] of the nonce range
3. mining process 3 mines [2*(2^32/N), 3*(2^32/N)] of the nonce range
... ...
N. mining process N mines [(N-1)*(2^32/N), N*(2^32/N)] of the nonce range
vip
Activity: 1316
Merit: 1043
👻
What OP is saying is that the higher the difficulty gets, the more likely a block after looping through all the possible nonce space will not have one that matches the difficulty. A dumb miner would keep repeating that loop and never ever find a block, a smart one would change some other part of the block like extraNonce.
hero member
Activity: 572
Merit: 506
UNLESS extraNounce were used.

Change the address that receives 25 BTC and u don't need extraNonce.
And there are other ways to make another attempt without using extraNonce: add a transaction to the block, remove a transaction, change their order, change timestamp.
kjj
legendary
Activity: 1302
Merit: 1026
Uh...

Difficulty and nonce are related in such a way that it takes roughly difficulty*232 hashes on average to find a valid block.  Meaning that when the difficulty is 25 million, like it is now, then of every 25 million iterations through the entire 32 bit nonce space, you will find one hash that meets the target criteria.  If that is what you mean by "failing", then we are doing it constantly.

The stock client has used extraNonce forever (at least for the last 2 years that I've been paying attention).  But there are several other variables in the header that can change along the way, and every miner uses them.

What I mean failing is that given a block header, by hashing from nonce 0 to nonce  2^32, no hash value less than the number required by current difficulty.

Yes, and today, we are failing about 25 million times every 10 minutes.  Difficulty is the number of times that we expect to fail in that task for each block.
member
Activity: 98
Merit: 10
Invest NASDAQ in Bitcoin
UNLESS extraNounce were used.

Change the address that receives 25 BTC and u don't need extraNonce.

You are right, but that's not efficient compare to just +1 on nonce or extranonce
member
Activity: 98
Merit: 10
Invest NASDAQ in Bitcoin
Uh...

Difficulty and nonce are related in such a way that it takes roughly difficulty*232 hashes on average to find a valid block.  Meaning that when the difficulty is 25 million, like it is now, then of every 25 million iterations through the entire 32 bit nonce space, you will find one hash that meets the target criteria.  If that is what you mean by "failing", then we are doing it constantly.

The stock client has used extraNonce forever (at least for the last 2 years that I've been paying attention).  But there are several other variables in the header that can change along the way, and every miner uses them.

What I mean failing is that given a block header, by hashing from nonce 0 to nonce  2^32, no hash value less than the number required by current difficulty.

legendary
Activity: 2142
Merit: 1010
Newbie
UNLESS extraNounce were used.

Change the address that receives 25 BTC and u don't need extraNonce.
kjj
legendary
Activity: 1302
Merit: 1026
Uh...

Difficulty and nonce are related in such a way that it takes roughly difficulty*232 hashes on average to find a valid block.  Meaning that when the difficulty is 25 million, like it is now, then of every 25 million iterations through the entire 32 bit nonce space, you will find one hash that meets the target criteria.  If that is what you mean by "failing", then we are doing it constantly.

The stock client has used extraNonce forever (at least for the last 2 years that I've been paying attention).  But there are several other variables in the header that can change along the way, and every miner uses them.
sr. member
Activity: 266
Merit: 250
aka 7Strykes
AFAIK no available mining software even uses extraNonce yet... so ASICs and current GPUs aren't doing it either.
member
Activity: 98
Merit: 10
Invest NASDAQ in Bitcoin
Any mining software or ASIC uses the extraNounce to mine?
We all know that the nounce is 4 byte number which maps to a 32 bytes sha256 output, there's a huge prbability that mining a block may fail if extraNounce is not used. I'm just wondering are those mining software or ASIC machines like BFL using it?


I was thinking about the mining function M(nounce_of_4_bytes) -> 32_bytes_sha256, and looked at the latest block hash "000000000000000fe5ed4fe9d5d6d976e0e567ccc6484835a9761a3bdf9df8f0".

This 32 bytes number is getting smaller and smaller, and the difficuty is gettting a big jump recently (http://bitcoindifficulty.com/), since if no extraNounce were used, the function M will definitely be a injective function, which means, when difficutly gets larger and larger, the mining will definitely has huge probability of failing and more and more frequently, UNLESS extraNounce were used.

Do you agree? What do you guys think about this?
Jump to: