18
8
Each one of bitcoin and its derived crypto-currencies has a nonce value in the block, no matter what the algorithm is. Every miner tries to search for a luck nonce which can make the hash value smaller than the target under the required difficulty.
However, recently I search scrypt based cryptocurrencies, like the dogecoin and vertcoin block chain for few blocks. I found most of the nonce are even numbers, except for (only manually browsed in block explorer)
Block #184161 - nonce = 8dce5c01
Block #184143 - nonce = 2a674001
Block #184139 - nonce = 930aa899
many other blocks from the latest block (Block #184174) and blocks in between of them are even numbers. Moreover, many nonce value are in hex number of form XXXXXX00 (in an integer hex number form, it is stored as 00XXXXXX in block), or multiples of 256.
The same outcome I observed in Vertcoin blocks. I manually traversed for few blocks and also found nonces of them are also even numbers.
I'd like to ask a question. If I configure the scrypt or n-scrypt to search only even numbers, is it possible to have higher chance to find the nonce which can solve the current quickly?
BTW, I won't expect the mining revenue of each miner in the pool (PPS or PPLNS) is going to be greater than that of normal nonce searching algorithm because the pool count for "shares" you found. When you skip odd numbers, you also lose the chance to get a share (solved by the odd nonce) which can meet the diff the pool gives to you. However, when a pool found a nonce that can solve the block, then the pool wins and gets the rewards.
Edited: Apr 18
I wrote a small program to collect some statistical data. From recent Dogecoin block #186,299 to #145,000 (the last mandatory update)
total 41,300 blocks
- number of odds = 3,891 (9.42%)
- number of evens = 37,409 (90.58%)
- ratio of odd to even is about 1:10
- Among the evens, the number of multiples of 256 = 35,106
- 85% of total
- 93.866% of evens
Update: 4/20
I recently also checked the nonces from block 552,780 to 253,898 of Litecoin.
totally 298,883 blocks.
- number of odds = 42,963 (14.374521%)
- number of evens = 255,920 (85.625479%)
- Among the evens, the number of multiples of 256 = 225,746
- 75.529890% of total
Update: 4/21
I use a small Perl script and call litecoind/dogecoind wallet to print out each block's nonce. It is very slow but quite simple. It would be very fast when you are using binary block database parser.
#!/usr/bin/perl -w
my $odd = 0;
my $even = 0;
my $m256 = 0;
my $total = 0;
for ($i = 186299; $i >= 145000; $i = $i-1) {
$nonce = `dogecoind getblock \`dogecoind getblockhash $i\` | grep nonce`;
chomp $nonce;
$nonce =~ s/[^0-9]*//g;
printf "%d %d\n", $i, $nonce;
if (($nonce %2)== 1) {
$odd++;
}
else {
$even = $even + 1;
$m256++ if (($nonce % 256) == 0);
}
$total ++;
}
printf "odds=%d (%f%%) evens=%d (%f%%) 256s=%d (%f%%)\n",
$odd, (100.0*$odd/$total),
$even, (100.0*$even/$total),
$m256, 100.0*$m256/$total;
2Every nonce has the same chance of solving a block or share. Using only even nonces will not change your odds at all. It could be that some mining software prefers to try even nonce values; perhaps it's more efficient on certain hardware or something. – Nate Eldredge – 2014-04-16T19:19:11.103
Yes, every odd or even number has the same probability to solve the block. However, the race game is that if your pool find a nonce solution earlier than other pool or others (solo), you win the round. Moreover, I don't think it is more efficient on certain hardware because only the nonce can be altered, the SHA and scrypt core algorithm could not be changed, every bit counts. – jclin – 2014-04-16T19:40:44.393
2I agree with @NateEldredge here. Also looking at an other scrypt based altcoin, Litcoin, I saw no significant difference between the occurrences of even and odd nonces. It seems to be related to Dodgecoin, not to the hashing algorithm in use. However, it would be interesting to know why the nonce values take this shape in Dodgecoin. Dodgecoin. – Jori – 2014-04-17T14:56:01.233
2I get similar statistical data among LTC and DOGE, (even Vertcoin). Don't known the reason but looks very interesting. – jclin – 2014-04-21T06:24:33.423
It would probably be pretty easy to perform a controlled test at low difficulty. If even nonces really are significantly more successful it would suggest a weakness in scrypt. – Nate Eldredge – 2014-04-21T13:35:53.353
Would you be willing to share the code that gathered your data? – Nate Eldredge – 2014-04-21T23:37:23.953
1@NateEldredge, please see my latest update. Just a small perl to retrieve block nonces. – jclin – 2014-04-22T01:56:12.323
1At this point, I believe your seemingly innocent question deserves an full-blown investigation, publishing its partial results in a blog, or even (should you polish them) in a journal. If the disparity holds true for other scrypt-based coins, you might have spotted a vulnerability or a nice way to increase profitability of miners! As Nate suggested, might be worth testing in an isolated, small network. Have you checked for SHA-256 based coins? Where can I tip you for your efforts? – Joe Pineda – 2014-04-23T03:31:02.700
Thanks for your suggestion, @JoePineda. Yes, I'm also conducting a small experiment. I didn't checked for SHA-256 based coins because I quickly browsed through few blocks of bitcoin and didn't see any regular patterns. When I checked Dogecoin block-chain, I noticed that even numbers appears more often, and in a block explorer, it shows the nonce in hex number so I noticed that so many nonces are multiplies of 256. And you can see my profile for the details. Thanks! – jclin – 2014-04-23T05:23:16.907
There is one variable that you are not considering however, if I was mining I would be right on this. The variable is the transactions that are included in the block, which is always random. – T9b – 2014-04-23T23:36:24.730
That's why I should test this on public p2p network, not a small and closed test-net. Moreover, the nonces found in the article are retrieved from existing public scrypt-based cryptocoins, no matter the number of transactions in each block is only few numbers or few dozens of transactions. – jclin – 2014-04-24T02:40:51.800
1Note that depending on endianness, "multiples of 256" == "small enough that I only bothered to fill in 3 bytes, not all 4" – Tim S. – 2014-04-24T20:36:34.890
I see your point. The getwork protocol provides data in little endian. Check LTC block 100000 , http://goo.gl/w0UWpx, and https://litecoin.info/Block_hashing_algorithm, the decimal number 2147586629, or 0x80019245 in hex, and is stored as 0x45,0x92,0x01,0x80 in little endian in block. The nonce you see either in the blockchain web or wallet (getblock method) are converted to host endian to show the 32-bit number (x86 is also little endian, so no convert need). That means all multiples of 256, which is in the form of XXXXXX00 in hex, are stored as "00XXXXXX" in the block.
– jclin – 2014-04-24T21:11:18.260