-
Notifications
You must be signed in to change notification settings - Fork 291
/
mainnetparams.go
426 lines (400 loc) · 15.7 KB
/
mainnetparams.go
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
// Copyright (c) 2014-2016 The btcsuite developers
// Copyright (c) 2015-2019 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package chaincfg
import (
"math/big"
"time"
"github.com/decred/dcrd/chaincfg/chainhash"
"github.com/decred/dcrd/wire"
)
// MainNetParams returns the network parameters for the main Decred network.
func MainNetParams() *Params {
// mainPowLimit is the highest proof of work value a Decred block can have
// for the main network. It is the value 2^224 - 1.
mainPowLimit := new(big.Int).Sub(new(big.Int).Lsh(bigOne, 224), bigOne)
// genesisBlock defines the genesis block of the block chain which serves as
// the public transaction ledger for the main network.
//
// The genesis block for Decred mainnet, testnet, and simnet are not
// evaluated for proof of work. The only values that are ever used elsewhere
// in the blockchain from it are:
// (1) The genesis block hash is used as the PrevBlock.
// (2) The difficulty starts off at the value given by Bits.
// (3) The stake difficulty starts off at the value given by SBits.
// (4) The timestamp, which guides when blocks can be built on top of it
// and what the initial difficulty calculations come out to be.
//
// The genesis block is valid by definition and none of the fields within it
// are validated for correctness.
genesisBlock := wire.MsgBlock{
Header: wire.BlockHeader{
Version: 1,
PrevBlock: chainhash.Hash{}, // All zero.
// MerkleRoot: Calculated below.
StakeRoot: chainhash.Hash{},
Timestamp: time.Unix(1454954400, 0), // Mon, 08 Feb 2016 18:00:00 GMT
Bits: 0x1b01ffff, // Difficulty 32767
SBits: 2 * 1e8, // 2 Coin
Nonce: 0x00000000,
StakeVersion: 0,
},
Transactions: []*wire.MsgTx{{
SerType: wire.TxSerializeFull,
Version: 1,
TxIn: []*wire.TxIn{{
// Fully null.
PreviousOutPoint: wire.OutPoint{
Hash: chainhash.Hash{},
Index: 0xffffffff,
Tree: 0,
},
SignatureScript: hexDecode("0000"),
Sequence: 0xffffffff,
BlockHeight: wire.NullBlockHeight,
BlockIndex: wire.NullBlockIndex,
ValueIn: wire.NullValueIn,
}},
TxOut: []*wire.TxOut{{
Version: 0x0000,
Value: 0x00000000,
PkScript: hexDecode("801679e98561ada96caec2949a5d41c4cab3851e" +
"b740d951c10ecbcf265c1fd9"),
}},
LockTime: 0,
Expiry: 0,
}},
}
genesisBlock.Header.MerkleRoot = genesisBlock.Transactions[0].TxHashFull()
return &Params{
Name: "mainnet",
Net: wire.MainNet,
DefaultPort: "9108",
DNSSeeds: []DNSSeed{
{"mainnet-seed.decred.mindcry.org", true},
{"mainnet-seed.decred.netpurgatory.com", true},
{"mainnet-seed.decred.org", true},
},
// Chain parameters
GenesisBlock: &genesisBlock,
GenesisHash: genesisBlock.BlockHash(),
PowLimit: mainPowLimit,
PowLimitBits: 0x1d00ffff,
ReduceMinDifficulty: false,
MinDiffReductionTime: 0, // Does not apply since ReduceMinDifficulty false
GenerateSupported: false,
MaximumBlockSizes: []int{393216},
MaxTxSize: 393216,
TargetTimePerBlock: time.Minute * 5,
WorkDiffAlpha: 1,
WorkDiffWindowSize: 144,
WorkDiffWindows: 20,
TargetTimespan: time.Minute * 5 * 144, // TimePerBlock * WindowSize
RetargetAdjustmentFactor: 4,
// Subsidy parameters.
BaseSubsidy: 3119582664, // 21m
MulSubsidy: 100,
DivSubsidy: 101,
SubsidyReductionInterval: 6144,
WorkRewardProportion: 6,
StakeRewardProportion: 3,
BlockTaxProportion: 1,
// Checkpoints ordered from oldest to newest.
Checkpoints: []Checkpoint{
{440, newHashFromStr("0000000000002203eb2c95ee96906730bb56b2985e174518f90eb4db29232d93")},
{24480, newHashFromStr("0000000000000c9d4239c4ef7ef3fb5aaeed940244bc69c57c8c5e1f071b28a6")},
{48590, newHashFromStr("0000000000000d5e0de21a96d3c965f5f2db2c82612acd7389c140c9afe92ba7")},
{54770, newHashFromStr("00000000000009293d067b1126b7de07fc9b2b94ee50dfe0d48c239a7adb072c")},
{60720, newHashFromStr("0000000000000a64475d68ffb9ad89a3d147c0f5138db26b40da9d19d0004117")},
{65270, newHashFromStr("0000000000000021f107601962789b201f0a0cbb98ac5f8c12b93d94e795b441")},
{75380, newHashFromStr("0000000000000e7d13cfc85806aa720fe3670980f5b7d33253e4f41985558372")},
{85410, newHashFromStr("00000000000013ec928074bea6eac9754aa614c7acb20edf300f18b0cd122692")},
{99880, newHashFromStr("0000000000000cb2a9a9ded647b9f78aae51ace32dd8913701d420ead272913c")},
{123080, newHashFromStr("000000000000009ea6e02d0f0424f445ed50686f9ae4aecdf3b268e981114477")},
{135960, newHashFromStr("00000000000001d2f9bbca9177972c0ba45acb40836b72945a75d73b99079498")},
{139740, newHashFromStr("00000000000001397179ae1aff156fb1aea228938d06b83e43b78b1c44527b5b")},
{155900, newHashFromStr("000000000000008557e37fb05177fc5a54e693de20689753639135f85a2dcb2e")},
{164300, newHashFromStr("000000000000009ed067ff51cd5e15f3c786222a5183b20a991a80ce535907a9")},
{181020, newHashFromStr("00000000000000b77d832cb2cbed02908d69323862a53e56345400ad81a6fb8f")},
{189950, newHashFromStr("000000000000007341d8ae2ea7e41f25cee00e1a70a4a3dc1cb055d14ecb2e11")},
{214672, newHashFromStr("0000000000000021d5cbeead55cb7fd659f07e8127358929ffc34cd362209758")},
{237310, newHashFromStr("000000000000000a6815e366425acd30354dfdcb55f401e38b037e87ca00f171")},
{259810, newHashFromStr("0000000000000000ee0fbf469a9f32477ffbb46ebd7a280a53c842ab4243f97c")},
{277940, newHashFromStr("000000000000000043b47c777bc96760e6fccc872cc8edb295b230dd8dd0f5d7")},
{295940, newHashFromStr("0000000000000000148852c8a919addf4043f9f267b13c08df051d359f1622ca")},
{318020, newHashFromStr("00000000000000002765c601fe4455126ab27913fcc2d2db28f78e1e6bb77266")},
{340120, newHashFromStr("00000000000000001a9ba30acfd8272aa1514ce7979fc508118ee3764a19df46")},
{362120, newHashFromStr("00000000000000000219580063387071893bcd0992cacb5f0aa55fc9e6c4a0ab")},
{384170, newHashFromStr("00000000000000001704bbc6bda8c4864a71cd0febcc0b44d753c69d83840f04")},
{404170, newHashFromStr("000000000000000010352022d88733bac2665c882030db071ce5ea29970fefd8")},
{424170, newHashFromStr("00000000000000000b8526a9fdd31fcb249c992fc0741d422528ce2fa975bbd0")},
{444170, newHashFromStr("00000000000000000673a109a997e8ca41bc4ece86445bc89c1bb2b9921633cc")},
{464170, newHashFromStr("0000000000000000063c4588ffa1ff25978c025eaf529f39bcbad8b962502f65")},
{483600, newHashFromStr("000000000000000010f98f7354b501b5747011c82d53b989dbcb368e5059ff9e")},
},
// MinKnownChainWork is the minimum amount of known total work for the
// chain at a given point in time. This is intended to be updated
// periodically with new releases.
//
// Block 00000000000000000b639b99ec8b3097ed3dac076c455d30139db0d5958d4c4a
// Height: 487720
MinKnownChainWork: hexToBigInt("00000000000000000000000000000000000000000013e6909b5a73128d52fc6f"),
// The miner confirmation window is defined as:
// target proof of work timespan / target proof of work spacing
RuleChangeActivationQuorum: 4032, // 10 % of RuleChangeActivationInterval * TicketsPerBlock
RuleChangeActivationMultiplier: 3, // 75%
RuleChangeActivationDivisor: 4,
RuleChangeActivationInterval: 2016 * 4, // 4 weeks
Deployments: map[uint32][]ConsensusDeployment{
4: {{
Vote: Vote{
Id: VoteIDSDiffAlgorithm,
Description: "Change stake difficulty algorithm as defined in DCP0001",
Mask: 0x0006, // Bits 1 and 2
Choices: []Choice{{
Id: "abstain",
Description: "abstain voting for change",
Bits: 0x0000,
IsAbstain: true,
IsNo: false,
}, {
Id: "no",
Description: "keep the existing algorithm",
Bits: 0x0002, // Bit 1
IsAbstain: false,
IsNo: true,
}, {
Id: "yes",
Description: "change to the new algorithm",
Bits: 0x0004, // Bit 2
IsAbstain: false,
IsNo: false,
}},
},
StartTime: 1493164800, // Apr 26th, 2017
ExpireTime: 1524700800, // Apr 26th, 2018
}, {
Vote: Vote{
Id: VoteIDLNSupport,
Description: "Request developers begin work on Lightning Network (LN) integration",
Mask: 0x0018, // Bits 3 and 4
Choices: []Choice{{
Id: "abstain",
Description: "abstain from voting",
Bits: 0x0000,
IsAbstain: true,
IsNo: false,
}, {
Id: "no",
Description: "no, do not work on integrating LN support",
Bits: 0x0008, // Bit 3
IsAbstain: false,
IsNo: true,
}, {
Id: "yes",
Description: "yes, begin work on integrating LN support",
Bits: 0x0010, // Bit 4
IsAbstain: false,
IsNo: false,
}},
},
StartTime: 1493164800, // Apr 26th, 2017
ExpireTime: 1508976000, // Oct 26th, 2017
}},
5: {{
Vote: Vote{
Id: VoteIDLNFeatures,
Description: "Enable features defined in DCP0002 and DCP0003 necessary to support Lightning Network (LN)",
Mask: 0x0006, // Bits 1 and 2
Choices: []Choice{{
Id: "abstain",
Description: "abstain voting for change",
Bits: 0x0000,
IsAbstain: true,
IsNo: false,
}, {
Id: "no",
Description: "keep the existing consensus rules",
Bits: 0x0002, // Bit 1
IsAbstain: false,
IsNo: true,
}, {
Id: "yes",
Description: "change to the new consensus rules",
Bits: 0x0004, // Bit 2
IsAbstain: false,
IsNo: false,
}},
},
StartTime: 1505260800, // Sep 13th, 2017
ExpireTime: 1536796800, // Sep 13th, 2018
}},
6: {{
Vote: Vote{
Id: VoteIDFixLNSeqLocks,
Description: "Modify sequence lock handling as defined in DCP0004",
Mask: 0x0006, // Bits 1 and 2
Choices: []Choice{{
Id: "abstain",
Description: "abstain voting for change",
Bits: 0x0000,
IsAbstain: true,
IsNo: false,
}, {
Id: "no",
Description: "keep the existing consensus rules",
Bits: 0x0002, // Bit 1
IsAbstain: false,
IsNo: true,
}, {
Id: "yes",
Description: "change to the new consensus rules",
Bits: 0x0004, // Bit 2
IsAbstain: false,
IsNo: false,
}},
},
StartTime: 1548633600, // Jan 28th, 2019
ExpireTime: 1580169600, // Jan 28th, 2020
}},
7: {{
Vote: Vote{
Id: VoteIDHeaderCommitments,
Description: "Enable header commitments as defined in DCP0005",
Mask: 0x0006, // Bits 1 and 2
Choices: []Choice{{
Id: "abstain",
Description: "abstain voting for change",
Bits: 0x0000,
IsAbstain: true,
IsNo: false,
}, {
Id: "no",
Description: "keep the existing consensus rules",
Bits: 0x0002, // Bit 1
IsAbstain: false,
IsNo: true,
}, {
Id: "yes",
Description: "change to the new consensus rules",
Bits: 0x0004, // Bit 2
IsAbstain: false,
IsNo: false,
}},
},
StartTime: 1567641600, // Sep 5th, 2019
ExpireTime: 1599264000, // Sep 5th, 2020
}},
8: {{
Vote: Vote{
Id: VoteIDTreasury,
Description: "Enable decentralized Treasury opcodes as defined in DCP0006",
Mask: 0x0006, // Bits 1 and 2
Choices: []Choice{{
Id: "abstain",
Description: "abstain voting for change",
Bits: 0x0000,
IsAbstain: true,
IsNo: false,
}, {
Id: "no",
Description: "keep the existing consensus rules",
Bits: 0x0002, // Bit 1
IsAbstain: false,
IsNo: true,
}, {
Id: "yes",
Description: "change to the new consensus rules",
Bits: 0x0004, // Bit 2
IsAbstain: false,
IsNo: false,
}},
},
StartTime: 1596240000, // Aug 1st, 2020
ExpireTime: 1627776000, // Aug 1st, 2021
}},
},
// Enforce current block version once majority of the network has
// upgraded.
// 75% (750 / 1000)
//
// Reject previous block versions once a majority of the network has
// upgraded.
// 95% (950 / 1000)
BlockEnforceNumRequired: 750,
BlockRejectNumRequired: 950,
BlockUpgradeNumToCheck: 1000,
// AcceptNonStdTxs is a mempool param to either accept and relay non
// standard txs to the network or reject them
AcceptNonStdTxs: false,
// Address encoding magics
NetworkAddressPrefix: "D",
PubKeyAddrID: [2]byte{0x13, 0x86}, // starts with Dk
PubKeyHashAddrID: [2]byte{0x07, 0x3f}, // starts with Ds
PKHEdwardsAddrID: [2]byte{0x07, 0x1f}, // starts with De
PKHSchnorrAddrID: [2]byte{0x07, 0x01}, // starts with DS
ScriptHashAddrID: [2]byte{0x07, 0x1a}, // starts with Dc
PrivateKeyID: [2]byte{0x22, 0xde}, // starts with Pm
// BIP32 hierarchical deterministic extended key magics
HDPrivateKeyID: [4]byte{0x02, 0xfd, 0xa4, 0xe8}, // starts with dprv
HDPublicKeyID: [4]byte{0x02, 0xfd, 0xa9, 0x26}, // starts with dpub
// BIP44 coin type used in the hierarchical deterministic path for
// address generation.
SLIP0044CoinType: 42, // SLIP0044, Decred
LegacyCoinType: 20, // for backwards compatibility
// Decred PoS parameters
MinimumStakeDiff: 2 * 1e8, // 2 Coin
TicketPoolSize: 8192,
TicketsPerBlock: 5,
TicketMaturity: 256,
TicketExpiry: 40960, // 5*TicketPoolSize
CoinbaseMaturity: 256,
SStxChangeMaturity: 1,
TicketPoolSizeWeight: 4,
StakeDiffAlpha: 1, // Minimal
StakeDiffWindowSize: 144,
StakeDiffWindows: 20,
StakeVersionInterval: 144 * 2 * 7, // ~1 week
MaxFreshStakePerBlock: 20, // 4*TicketsPerBlock
StakeEnabledHeight: 256 + 256, // CoinbaseMaturity + TicketMaturity
StakeValidationHeight: 4096, // ~14 days
StakeBaseSigScript: []byte{0x00, 0x00},
StakeMajorityMultiplier: 3,
StakeMajorityDivisor: 4,
// Decred organization related parameters
// Organization address is Dcur2mcGjmENx4DhNqDctW5wJCVyT3Qeqkx
OrganizationPkScript: hexDecode("a914f5916158e3e2c4551c1796708db8367207ed13bb87"),
OrganizationPkScriptVersion: 0,
BlockOneLedger: tokenPayouts_MainNetParams(),
// Sanctioned Politeia keys.
PiKeys: [][]byte{
hexDecode("03f6e7041f1cf51ee10e0a01cd2b0385ce3cd9debaabb2296f7e9dee9329da946c"),
hexDecode("0319a37405cb4d1691971847d7719cfce70857c0f6e97d7c9174a3998cf0ab86dd"),
},
// ~1 day for tspend inclusion
TreasuryVoteInterval: 288,
// ~7.2 days for short circuit approval, ~42%
// target=ticket-pool-equivalent participation
TreasuryVoteIntervalMultiplier: 12,
// Sum of tspends within any ~24 day window cannot exceed
// policy check
TreasuryExpenditureWindow: 2,
// policy check is average of prior ~4.8 months + a 50%
// increase allowance
TreasuryExpenditurePolicy: 6,
// 16000 dcr/tew as expense bootstrap
TreasuryExpenditureBootstrap: 16000 * 1e8,
TreasuryVoteQuorumMultiplier: 1, // 20% quorum required
TreasuryVoteQuorumDivisor: 5,
TreasuryVoteRequiredMultiplier: 3, // 60% yes votes required
TreasuryVoteRequiredDivisor: 5,
seeders: []string{
"mainnet-seed-1.decred.org",
"mainnet-seed-2.decred.org",
"mainnet-seed.planetdecred.org",
"mainnet-seed.dcrdata.org",
"mainnet-seed.jholdstock.uk",
},
}
}