-
Notifications
You must be signed in to change notification settings - Fork 42
/
Decred_NiceHash.txt
118 lines (95 loc) · 4.36 KB
/
Decred_NiceHash.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
-------------------------------------------------------------------------
NiceHash presents
=========================================================================
Decred mining used on NiceHash
=========================================================================
revision of this document: R4
I. Introduction & Concept
II. Specifications (RFC)
III. Contact
I. Introduction & Concept
-------------------------
Following block header is used in Decred:
0x01, 0x00, 0x00, 0x00, // Version 1
0x6f, 0xe2, 0x8c, 0x0a, 0xb6, 0xf1, 0xb3, 0x72, // PrevBlock
0xc1, 0xa6, 0xa2, 0x46, 0xae, 0x63, 0xf7, 0x4f,
0x93, 0x1e, 0x83, 0x65, 0xe1, 0x5a, 0x08, 0x9c,
0x68, 0xd6, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00,
0x3b, 0xa3, 0xed, 0xfd, 0x7a, 0x7b, 0x12, 0xb2, // MerkleRoot
0x7a, 0xc7, 0x2c, 0x3e, 0x67, 0x76, 0x8f, 0x61,
0x7f, 0xc8, 0x1b, 0xc3, 0x88, 0x8a, 0x51, 0x32,
0x3a, 0x9f, 0xb8, 0xaa, 0x4b, 0x1e, 0x5e, 0x4a,
0x3b, 0xa3, 0xed, 0xfd, 0x7a, 0x7b, 0x12, 0xb2, // StakeRoot
0x7a, 0xc7, 0x2c, 0x3e, 0x67, 0x76, 0x8f, 0x61,
0x7f, 0xc8, 0x1b, 0xc3, 0x88, 0x8a, 0x51, 0x32,
0x3a, 0x9f, 0xb8, 0xaa, 0x4b, 0x1e, 0x5e, 0x4a,
0x00, 0x00, // VoteBits
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // FinalState
0x00, 0x00, // Voters
0x00, // FreshStake
0x00, // Revocations
0x00, 0x00, 0x00, 0x00, //Poolsize
0xff, 0xff, 0x00, 0x1d, // Bits
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SBits
0x00, 0x00, 0x00, 0x00, // Height
0x00, 0x00, 0x00, 0x00, // Size
0x29, 0xab, 0x5f, 0x49, // Timestamp
0xf3, 0xe0, 0x01, 0x00, // Nonce
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ExtraData
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00 // Stake version 3
There are 36 bytes in ExtraData field that can be used for random user-
defined data.
First up to 8 bytes of data is used for ExtraNonce1 in standard stratum
mining protocol. ExtraNonce1 is set for each miner by the pool and no two
miners shall have same ExtraNonce1. Pool makes sure that no two miners
ever perform same work.
Following X bytes of ExtraNonce1 inside ExtraData are up to 8 bytes used
for ExtraNonce2. Size of ExtraNonce2 is defined by the pool (just like in
standard stratum protocol). ExtraNonce2 is an extension for miner's nonce,
because miner may run out of nonce range, thus it can increase
ExtraNonce2 to be able to hash unique work again.
If pool chooses to use 4 bytes for ExtraNonce1 and 8 bytes for
ExtraNonce2, then block header would look like:
...
0x29, 0xab, 0x5f, 0x49, // Timestamp
0xf3, 0xe0, 0x01, 0x00, // Nonce
0x00, 0x00, 0x00, 0x00, // ExtraNonce1
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ExtraNonce2
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // remaining ExtraData
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00 // Stake version
Remaining ExtraData must always be padded with nulls!
When pool sends out the job (mining.notify), it should set following
parameters:
params[0] = Job ID.
params[1] = PrevBlock (32 bytes).
params[2] = MerkleRoot, StakeRoot,... Height, Size (together 100 bytes).
params[3] = Stake version (4 bytes).
params[4][] = Unused. Set to [].
params[5] = Version.
params[6] = Unused. Set to "".
params[7] = Timestamp (miner can roll this value as fast as time goes)
params[8] = Clean Jobs.
Miner generates work for hashing by combining:
Version (params[5]) + PrevBlock (params[1]) + MerkleRoot, StakeRoot,...
Height, Size (params[2]) + Timestamp (params[7] + Nonce (selected by
miner) + ExtraNonce1 (send by the pool at start) + ExtraNonce2 (selected
by miner) + padding (if needed) + Stake version (params[3])
II. Specifications (RFC)
-------------------------
Standard stratum protocol is used with adjustments explained in I.
Miners should support extranonce.subscribe for optimal performance when
mining on NiceHash.
R2 update: It is allowed to send coinbase1 being more than 100 bytes.
In that case, miners just take first 100 bytes and discard the rest.
R3 update: Stake version added at the end of Extra data. Stake version
is provided as third parameter in mining.notify.
R4 update: Stake version mistake fix (LE/BE).
III. Contact
-----------
www.nicehash.com