-
Notifications
You must be signed in to change notification settings - Fork 290
/
testnetparams.go
311 lines (285 loc) · 10.8 KB
/
testnetparams.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
// 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"
)
// TestNet3Params return the network parameters for the test currency network.
// This network is sometimes simply called "testnet".
// This is the third public iteration of testnet.
func TestNet3Params() *Params {
// testNetPowLimit is the highest proof of work value a Decred block
// can have for the test network. It is the value 2^232 - 1.
testNetPowLimit := new(big.Int).Sub(new(big.Int).Lsh(bigOne, 232), bigOne)
// genesisBlock defines the genesis block of the block chain which serves as
// the public transaction ledger for the test network (version 3).
genesisBlock := wire.MsgBlock{
Header: wire.BlockHeader{
Version: 6,
PrevBlock: chainhash.Hash{},
// MerkleRoot: Calculated below.
Timestamp: time.Unix(1533513600, 0), // 2018-08-06 00:00:00 +0000 UTC
Bits: 0x1e00ffff, // Difficulty 1 [000000ffff000000000000000000000000000000000000000000000000000000]
SBits: 20000000,
Nonce: 0x18aea41a,
StakeVersion: 6,
},
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,
}},
}
// NOTE: This really should be TxHashFull, but it was defined incorrectly.
//
// Since the field is not used in any validation code, it does not have any
// adverse effects, but correcting it would result in changing the block
// hash which would invalidate the entire test network. The next test
// network should set the value properly.
genesisBlock.Header.MerkleRoot = genesisBlock.Transactions[0].TxHash()
return &Params{
Name: "testnet3",
Net: wire.TestNet3,
DefaultPort: "19108",
DNSSeeds: []DNSSeed{
{"testnet-seed.decred.mindcry.org", true},
{"testnet-seed.decred.netpurgatory.com", true},
{"testnet-seed.decred.org", true},
},
// Chain parameters
GenesisBlock: &genesisBlock,
GenesisHash: genesisBlock.BlockHash(),
PowLimit: testNetPowLimit,
PowLimitBits: 0x1e00ffff,
ReduceMinDifficulty: true,
MinDiffReductionTime: time.Minute * 10, // ~99.3% chance to be mined before reduction
GenerateSupported: true,
MaximumBlockSizes: []int{1310720},
MaxTxSize: 1000000,
TargetTimePerBlock: time.Minute * 2,
WorkDiffAlpha: 1,
WorkDiffWindowSize: 144,
WorkDiffWindows: 20,
TargetTimespan: time.Minute * 2 * 144, // TimePerBlock * WindowSize
RetargetAdjustmentFactor: 4,
// Subsidy parameters.
BaseSubsidy: 2500000000, // 25 Coin
MulSubsidy: 100,
DivSubsidy: 101,
SubsidyReductionInterval: 2048,
WorkRewardProportion: 6,
StakeRewardProportion: 3,
BlockTaxProportion: 1,
// Checkpoints ordered from oldest to newest.
Checkpoints: []Checkpoint{
{83520, newHashFromStr("0000000001e6244d95feae8b598e854905158c7bc781daf874afff88675ef0c8")},
{148320, newHashFromStr("0000000003535b80e4b759b8ec1790f81f429d9f5a810eda43c3afb64d9760b1")},
{213120, newHashFromStr("000000000009bb6909db742278f3ab7c9169ef396068cce7f750b587b72738af")},
{282340, newHashFromStr("0000001f538d6343316fe50709fa544b680a1be38141d003e755da8ad30f67a8")},
{347140, newHashFromStr("0000001638f00f197b882a00db04d1323e205f45bf1108e4f1bbc1f456d4250c")},
{411940, newHashFromStr("00000012b6d21f31f18a2f6d8b64e111327f011ac13a1b3e9d0d8b477f71f62b")},
{476740, newHashFromStr("00000005635a4b783ad4d85e0cb92f094e2e885a92ef4d6b8464b22a02646279")},
{515730, newHashFromStr("00000010ecddf8da5d91f7020f69130db8a163906d460cbbed2a91568701f0ac")},
},
// 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 000000097a93845014d7865997154cc186be0435742e0d3c37c019ff118493fa
// Height: 519845
MinKnownChainWork: hexToBigInt("000000000000000000000000000000000000000000000000e41955f181d00f59"),
// Consensus rule change deployments.
//
// The miner confirmation window is defined as:
// target proof of work timespan / target proof of work spacing
RuleChangeActivationQuorum: 2520, // 10 % of RuleChangeActivationInterval * TicketsPerBlock
RuleChangeActivationMultiplier: 3, // 75%
RuleChangeActivationDivisor: 4,
RuleChangeActivationInterval: 5040, // 1 week
Deployments: map[uint32][]ConsensusDeployment{
7: {{
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
}},
8: {{
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
}},
9: {{
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.
// 51% (51 / 100)
// Reject previous block versions once a majority of the network has
// upgraded.
// 75% (75 / 100)
BlockEnforceNumRequired: 51,
BlockRejectNumRequired: 75,
BlockUpgradeNumToCheck: 100,
// AcceptNonStdTxs is a mempool param to either accept and relay non
// standard txs to the network or reject them
AcceptNonStdTxs: true,
// Address encoding magics
NetworkAddressPrefix: "T",
PubKeyAddrID: [2]byte{0x28, 0xf7}, // starts with Tk
PubKeyHashAddrID: [2]byte{0x0f, 0x21}, // starts with Ts
PKHEdwardsAddrID: [2]byte{0x0f, 0x01}, // starts with Te
PKHSchnorrAddrID: [2]byte{0x0e, 0xe3}, // starts with TS
ScriptHashAddrID: [2]byte{0x0e, 0xfc}, // starts with Tc
PrivateKeyID: [2]byte{0x23, 0x0e}, // starts with Pt
// BIP32 hierarchical deterministic extended key magics
HDPrivateKeyID: [4]byte{0x04, 0x35, 0x83, 0x97}, // starts with tprv
HDPublicKeyID: [4]byte{0x04, 0x35, 0x87, 0xd1}, // starts with tpub
// BIP44 coin type used in the hierarchical deterministic path for
// address generation.
SLIP0044CoinType: 1, // SLIP0044, Testnet (all coins)
LegacyCoinType: 11, // for backwards compatibility
// Decred PoS parameters
MinimumStakeDiff: 20000000, // 0.2 Coin
TicketPoolSize: 1024,
TicketsPerBlock: 5,
TicketMaturity: 16,
TicketExpiry: 6144, // 6*TicketPoolSize
CoinbaseMaturity: 16,
SStxChangeMaturity: 1,
TicketPoolSizeWeight: 4,
StakeDiffAlpha: 1,
StakeDiffWindowSize: 144,
StakeDiffWindows: 20,
StakeVersionInterval: 144 * 2 * 7, // ~1 week
MaxFreshStakePerBlock: 20, // 4*TicketsPerBlock
StakeEnabledHeight: 16 + 16, // CoinbaseMaturity + TicketMaturity
StakeValidationHeight: 768, // Arbitrary
StakeBaseSigScript: []byte{0x00, 0x00},
StakeMajorityMultiplier: 3,
StakeMajorityDivisor: 4,
// Decred organization related parameters.
// Organization address is TcrypGAcGCRVXrES7hWqVZb5oLJKCZEtoL1.
OrganizationPkScript: hexDecode("a914d585cd7426d25b4ea5faf1e6987aacfeda3db94287"),
OrganizationPkScriptVersion: 0,
BlockOneLedger: tokenPayouts_TestNet3Params(),
// Sanctioned Politeia keys.
PiKeys: [][]byte{
hexDecode("03beca9bbd227ca6bb5a58e03a36ba2b52fff09093bd7a50aee1193bccd257fb8a"),
hexDecode("03e647c014f55265da506781f0b2d67674c35cb59b873d9926d483c4ced9a7bbd3"),
},
// ~2 hours for tspend inclusion
TreasuryVoteInterval: 60,
// ~4.8 hours for short circuit approval
TreasuryVoteIntervalMultiplier: 4,
// ~1 day policy window
TreasuryExpenditureWindow: 4,
// ~6 day policy window check
TreasuryExpenditurePolicy: 3,
// 10000 dcr/tew as expense bootstrap
TreasuryExpenditureBootstrap: 10000 * 1e8,
TreasuryVoteQuorumMultiplier: 1, // 20% quorum required
TreasuryVoteQuorumDivisor: 5,
TreasuryVoteRequiredMultiplier: 3, // 60% yes votes required
TreasuryVoteRequiredDivisor: 5,
seeders: []string{
"testnet-seed-1.decred.org",
"testnet-seed-2.decred.org",
},
}
}