aboutsummaryrefslogtreecommitdiffstats
path: root/core/genesis.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-10-20 16:49:46 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:50 +0800
commit0a3d913bf68dd165337ac20977b8379fd1acf469 (patch)
treeee1d975bbc11593ca25c81cef81c86f3f4de98fe /core/genesis.go
parentdca561583b7657dd65b39e0a196cb026d608ba11 (diff)
downloaddexon-0a3d913bf68dd165337ac20977b8379fd1acf469.tar
dexon-0a3d913bf68dd165337ac20977b8379fd1acf469.tar.gz
dexon-0a3d913bf68dd165337ac20977b8379fd1acf469.tar.bz2
dexon-0a3d913bf68dd165337ac20977b8379fd1acf469.tar.lz
dexon-0a3d913bf68dd165337ac20977b8379fd1acf469.tar.xz
dexon-0a3d913bf68dd165337ac20977b8379fd1acf469.tar.zst
dexon-0a3d913bf68dd165337ac20977b8379fd1acf469.zip
core: populate genesisAlloc in source code with DEXON genesis data
Diffstat (limited to 'core/genesis.go')
-rw-r--r--core/genesis.go32
1 files changed, 24 insertions, 8 deletions
diff --git a/core/genesis.go b/core/genesis.go
index 4d3edb3e8..b73ad10f9 100644
--- a/core/genesis.go
+++ b/core/genesis.go
@@ -354,10 +354,11 @@ func GenesisBlockForTesting(db ethdb.Database, addr common.Address, balance *big
func DefaultGenesisBlock() *Genesis {
return &Genesis{
Config: params.MainnetChainConfig,
- Nonce: 66,
- ExtraData: hexutil.MustDecode("0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa"),
- GasLimit: 5000,
- Difficulty: big.NewInt(17179869184),
+ Timestamp: 1540024964,
+ Nonce: 42,
+ ExtraData: hexutil.MustDecode("0x5765692d4e696e6720536f6e696320426f6a696520323031382d31302d32302e"),
+ GasLimit: 8000000,
+ Difficulty: big.NewInt(1),
Alloc: decodePrealloc(mainnetAllocData),
}
}
@@ -366,10 +367,10 @@ func DefaultGenesisBlock() *Genesis {
func DefaultTestnetGenesisBlock() *Genesis {
return &Genesis{
Config: params.TestnetChainConfig,
- Nonce: 66,
+ Nonce: 42,
ExtraData: hexutil.MustDecode("0x3535353535353535353535353535353535353535353535353535353535353535"),
GasLimit: 16777216,
- Difficulty: big.NewInt(1048576),
+ Difficulty: big.NewInt(1),
Alloc: decodePrealloc(testnetAllocData),
}
}
@@ -426,13 +427,28 @@ func DeveloperGenesisBlock(period uint64, faucet common.Address) *Genesis {
}
func decodePrealloc(data string) GenesisAlloc {
- var p []struct{ Addr, Balance *big.Int }
+ type accountData struct {
+ Balance *big.Int
+ Staked *big.Int
+ Code []byte
+ PublicKey []byte
+ }
+
+ var p []struct {
+ Addr *big.Int
+ Account accountData
+ }
if err := rlp.NewStream(strings.NewReader(data), 0).Decode(&p); err != nil {
panic(err)
}
ga := make(GenesisAlloc, len(p))
for _, account := range p {
- ga[common.BigToAddress(account.Addr)] = GenesisAccount{Balance: account.Balance}
+ ga[common.BigToAddress(account.Addr)] = GenesisAccount{
+ Balance: account.Account.Balance,
+ Staked: account.Account.Staked,
+ Code: account.Account.Code,
+ PublicKey: account.Account.PublicKey,
+ }
}
return ga
}