forked from kaspanet/kaspad
-
Notifications
You must be signed in to change notification settings - Fork 7
/
genesis.go
240 lines (212 loc) · 9.7 KB
/
genesis.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
// Copyright (c) 2014-2016 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package dagconfig
import (
"math/big"
"github.com/Hoosat-Oy/HTND/domain/consensus/model/externalapi"
"github.com/Hoosat-Oy/HTND/domain/consensus/utils/blockheader"
"github.com/Hoosat-Oy/HTND/domain/consensus/utils/subnetworks"
"github.com/Hoosat-Oy/HTND/domain/consensus/utils/transactionhelper"
"github.com/kaspanet/go-muhash"
)
var genesisTxOuts = []*externalapi.DomainTransactionOutput{}
var genesisTxPayload = []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Blue score
0x00, 0xE1, 0xF5, 0x05, 0x00, 0x00, 0x00, 0x00, // Subsidy
0x00, 0x00, //script version
0x01, // Varint
0x00, // OP-FALSE
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x46, 0xa1, 0x51, 0xf8, 0xa4, 0xe4,
0x59, 0x1c, 0x45, 0xe8, 0x35, 0xdf, 0xca, 0x4a,
0xc9, 0x9a, 0x73, 0x8a, 0x54, 0xa4, 0x5a, 0x65,
0x48, 0x6f, 0x6f, 0x73, 0x61, 0x74, 0x20, 0x69,
0x73, 0x20, 0x74, 0x68, 0x65, 0x72, 0x65, 0x20,
0x66, 0x6f, 0x72, 0x20, 0x79, 0x6f, 0x75, 0x2c,
0x20, 0x64, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x72,
0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x20, 0x6f,
0x70, 0x65, 0x6e, 0x20, 0x6c, 0x6f, 0x77, 0x20,
0x65, 0x6e, 0x74, 0x72, 0x79, 0x20, 0x63, 0x72,
0x79, 0x70, 0x74, 0x6f, 0x20, 0x69, 0x6e, 0x20,
0x74, 0x68, 0x65, 0x20, 0x77, 0x6f, 0x72, 0x6c,
0x64, 0x2c, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x61,
0x72, 0x65, 0x20, 0x74, 0x68, 0x65, 0x72, 0x65,
0x20, 0x66, 0x6f, 0x72, 0x20, 0x48, 0x6f, 0x6f,
0x73, 0x61, 0x74, 0x2e,
}
// genesisCoinbaseTx is the coinbase transaction for the genesis blocks for
// the main network.
var genesisCoinbaseTx = transactionhelper.NewSubnetworkTransaction(0, []*externalapi.DomainTransactionInput{}, genesisTxOuts,
&subnetworks.SubnetworkIDCoinbase, 0, genesisTxPayload)
// genesisHash is the hash of the first block in the block DAG for the main
// network (genesis block).
var genesisHash = externalapi.NewDomainHashFromByteArray(&[externalapi.DomainHashSize]byte{
0xc3, 0x00, 0x3a, 0x48, 0x36, 0xc3, 0x9a, 0x79, 0x65, 0xfc, 0x92, 0x24, 0x1a, 0x2a, 0x2e, 0x95, 0x04, 0x39, 0x9f, 0xe2, 0x69, 0x4f, 0xf2, 0x52, 0x76, 0xf7, 0xea, 0x47, 0xdd, 0xe7, 0xa7, 0x83,
})
// genesisMerkleRoot is the hash of the first transaction in the genesis block
// for the main network.
var genesisMerkleRoot = externalapi.NewDomainHashFromByteArray(&[externalapi.DomainHashSize]byte{
0x6a, 0x13, 0x31, 0xd7, 0xb8, 0x9b, 0xab, 0x3d, 0x89, 0x58, 0x62, 0xe7, 0x12, 0x9d, 0xe2, 0x45, 0x64, 0x02, 0x48, 0xec, 0x3a, 0xb1, 0x25, 0x70, 0x01, 0xa3, 0x78, 0x2e, 0x65, 0xab, 0xf2, 0xff,
})
// genesisBlock defines the genesis block of the block DAG which serves as the
// public transaction ledger for the main network.
var genesisBlock = externalapi.DomainBlock{
Header: blockheader.NewImmutableBlockHeader(
0,
[]externalapi.BlockLevelParents{},
genesisMerkleRoot,
&externalapi.DomainHash{},
externalapi.NewDomainHashFromByteArray(muhash.EmptyMuHashHash.AsArray()),
1709371763896,
511705087,
83330,
0,
0,
big.NewInt(0),
&externalapi.DomainHash{},
),
Transactions: []*externalapi.DomainTransaction{genesisCoinbaseTx},
}
var devnetGenesisTxOuts = []*externalapi.DomainTransactionOutput{}
var devnetGenesisTxPayload = []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Blue score
0x00, 0xE1, 0xF5, 0x05, 0x00, 0x00, 0x00, 0x00, // Subsidy
0x00, 0x00, // Script version
0x01, // Varint
0x00, // OP-FALSE
0x6b, 0x61, 0x73, 0x70, 0x61, 0x2d, 0x64, 0x65, 0x76, 0x6e, 0x65, 0x74, // hoosat-devnet
}
// devnetGenesisCoinbaseTx is the coinbase transaction for the genesis blocks for
// the development network.
var devnetGenesisCoinbaseTx = transactionhelper.NewSubnetworkTransaction(0,
[]*externalapi.DomainTransactionInput{}, devnetGenesisTxOuts,
&subnetworks.SubnetworkIDCoinbase, 0, devnetGenesisTxPayload)
// devGenesisHash is the hash of the first block in the block DAG for the development
// network (genesis block).
var devnetGenesisHash = externalapi.NewDomainHashFromByteArray(&[externalapi.DomainHashSize]byte{
0xb3, 0x13, 0x87, 0x0a, 0x32, 0xc7, 0x04, 0xbd, 0xf1, 0x21, 0x4a, 0x3b, 0x27, 0x0c, 0xc4, 0x75, 0xd9, 0x42, 0xc2, 0x09, 0x2d, 0x37, 0x9b, 0xc8, 0x70, 0x0a, 0xb0, 0x43, 0x31, 0x9e, 0xf8, 0x46,
})
// devnetGenesisMerkleRoot is the hash of the first transaction in the genesis block
// for the devopment network.
var devnetGenesisMerkleRoot = externalapi.NewDomainHashFromByteArray(&[externalapi.DomainHashSize]byte{
0x58, 0xab, 0xf2, 0x03, 0x21, 0xd7, 0x07, 0x16,
0x16, 0x2b, 0x6b, 0xf8, 0xd9, 0xf5, 0x89, 0xca,
0x33, 0xae, 0x6e, 0x32, 0xb3, 0xb1, 0x9a, 0xbb,
0x7f, 0xa6, 0x5d, 0x11, 0x41, 0xa3, 0xf9, 0x4d,
})
// devnetGenesisBlock defines the genesis block of the block DAG which serves as the
// public transaction ledger for the development network.
var devnetGenesisBlock = externalapi.DomainBlock{
Header: blockheader.NewImmutableBlockHeader(
0,
[]externalapi.BlockLevelParents{},
devnetGenesisMerkleRoot,
&externalapi.DomainHash{},
externalapi.NewDomainHashFromByteArray(muhash.EmptyMuHashHash.AsArray()),
0x11e9db49828,
525264379,
0x48e5e,
0,
0,
big.NewInt(0),
&externalapi.DomainHash{},
),
Transactions: []*externalapi.DomainTransaction{devnetGenesisCoinbaseTx},
}
var simnetGenesisTxOuts = []*externalapi.DomainTransactionOutput{}
var simnetGenesisTxPayload = []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Blue score
0x00, 0xE1, 0xF5, 0x05, 0x00, 0x00, 0x00, 0x00, // Subsidy
0x00, 0x00, // Script version
0x01, // Varint
0x00, // OP-FALSE
0x6b, 0x61, 0x73, 0x70, 0x61, 0x2d, 0x73, 0x69, 0x6d, 0x6e, 0x65, 0x74, // hoosat-simnet
}
// simnetGenesisCoinbaseTx is the coinbase transaction for the simnet genesis block.
var simnetGenesisCoinbaseTx = transactionhelper.NewSubnetworkTransaction(0,
[]*externalapi.DomainTransactionInput{}, simnetGenesisTxOuts,
&subnetworks.SubnetworkIDCoinbase, 0, simnetGenesisTxPayload)
// simnetGenesisHash is the hash of the first block in the block DAG for
// the simnet (genesis block).
var simnetGenesisHash = externalapi.NewDomainHashFromByteArray(&[externalapi.DomainHashSize]byte{
0x41, 0x1f, 0x8c, 0xd2, 0x6f, 0x3d, 0x41, 0xae,
0xa3, 0x9e, 0x78, 0x57, 0x39, 0x27, 0xda, 0x24,
0xd2, 0x39, 0x95, 0x70, 0x5b, 0x57, 0x9f, 0x30,
0x95, 0x9b, 0x91, 0x27, 0xe9, 0x6b, 0x79, 0xe3,
})
// simnetGenesisMerkleRoot is the hash of the first transaction in the genesis block
// for the devopment network.
var simnetGenesisMerkleRoot = externalapi.NewDomainHashFromByteArray(&[externalapi.DomainHashSize]byte{
0x19, 0x46, 0xd6, 0x29, 0xf7, 0xe9, 0x22, 0xa7,
0xbc, 0xed, 0x59, 0x19, 0x05, 0x21, 0xc3, 0x77,
0x1f, 0x73, 0xd3, 0x52, 0xdd, 0xbb, 0xb6, 0x86,
0x56, 0x4a, 0xd7, 0xfd, 0x56, 0x85, 0x7c, 0x1b,
})
// simnetGenesisBlock defines the genesis block of the block DAG which serves as the
// public transaction ledger for the development network.
var simnetGenesisBlock = externalapi.DomainBlock{
Header: blockheader.NewImmutableBlockHeader(
0,
[]externalapi.BlockLevelParents{},
simnetGenesisMerkleRoot,
&externalapi.DomainHash{},
externalapi.NewDomainHashFromByteArray(muhash.EmptyMuHashHash.AsArray()),
0x17c5f62fbb6,
0x207fffff,
0x2,
0,
0,
big.NewInt(0),
&externalapi.DomainHash{},
),
Transactions: []*externalapi.DomainTransaction{simnetGenesisCoinbaseTx},
}
var testnetGenesisTxOuts = []*externalapi.DomainTransactionOutput{}
var testnetGenesisTxPayload = []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Blue score
0x00, 0xE1, 0xF5, 0x05, 0x00, 0x00, 0x00, 0x00, // Subsidy
0x00, 0x00, // Script version
0x01, // Varint
0x00, // OP-FALSE
0x68, 0x6F, 0x6F, 0x73, 0x61, 0x74, 0x2D, 0x74, 0x65, 0x73, 0x74, 0x6E, 0x65, 0x74, // hoosat-testnet
}
// testnetGenesisCoinbaseTx is the coinbase transaction for the testnet genesis block.
var testnetGenesisCoinbaseTx = transactionhelper.NewSubnetworkTransaction(0,
[]*externalapi.DomainTransactionInput{}, testnetGenesisTxOuts,
&subnetworks.SubnetworkIDCoinbase, 0, testnetGenesisTxPayload)
// testnetGenesisHash is the hash of the first block in the block DAG for the test
// network (genesis block).
var testnetGenesisHash = externalapi.NewDomainHashFromByteArray(&[externalapi.DomainHashSize]byte{
0x46, 0x9C, 0xB7, 0x25, 0x86, 0x03, 0x8E, 0x61,
0x19, 0x9E, 0x80, 0x7D, 0xFA, 0x0D, 0x8E, 0xF7,
0xBD, 0xEB, 0x48, 0xB2, 0x20, 0x59, 0xE7, 0x03,
0xE6, 0x1D, 0xA4, 0xE7, 0xD2, 0xB3, 0x03, 0xB3,
})
// testnetGenesisMerkleRoot is the hash of the first transaction in the genesis block
// for testnet.
var testnetGenesisMerkleRoot = externalapi.NewDomainHashFromByteArray(&[externalapi.DomainHashSize]byte{
0xDB, 0x85, 0xD7, 0x57, 0x76, 0x1C, 0x48, 0x77,
0x89, 0x8D, 0x86, 0x2E, 0x17, 0xC4, 0x71, 0xA1,
0x2F, 0xCE, 0xED, 0x07, 0xCF, 0x99, 0x5F, 0x69,
0x69, 0x13, 0x20, 0x07, 0x37, 0x86, 0x0E, 0x16,
})
// testnetGenesisBlock defines the genesis block of the block DAG which serves as the
// public transaction ledger for testnet.
var testnetGenesisBlock = externalapi.DomainBlock{
Header: blockheader.NewImmutableBlockHeader(
0,
[]externalapi.BlockLevelParents{},
testnetGenesisMerkleRoot,
&externalapi.DomainHash{},
externalapi.NewDomainHashFromByteArray(muhash.EmptyMuHashHash.AsArray()),
0x17c5f62fbb6,
0x1e7fffff,
0x14582,
0,
0,
big.NewInt(0),
&externalapi.DomainHash{},
),
Transactions: []*externalapi.DomainTransaction{testnetGenesisCoinbaseTx},
}