Skip to content

Commit

Permalink
add default config for side chain
Browse files Browse the repository at this point in the history
  • Loading branch information
TATAUFO committed Jun 25, 2019
1 parent ae97948 commit 8a827c6
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/utils/flags.go
Expand Up @@ -1109,6 +1109,12 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {

// Override any default configs for hard coded networks.
switch {
case ctx.GlobalBool(SCAEnableFlag.Name):
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 8123
}
cfg.SyncMode = downloader.FullSync
cfg.Genesis = core.DefaultSCGenesisBlock()
case ctx.GlobalBool(TestnetFlag.Name):
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 8341
Expand Down
15 changes: 15 additions & 0 deletions core/genesis.go
Expand Up @@ -343,6 +343,21 @@ func DefaultTestnetGenesisBlock() *Genesis {
}
}

// DefaultSCGenesisBlock returns the Ropsten network genesis block.
func DefaultSCGenesisBlock() *Genesis {

return &Genesis{
Config: params.SideChainConfig,
Timestamp: 1554004800,
Nonce: 0,
ExtraData: hexutil.MustDecode("0x436f6769746f206572676f2073756d2e20457863657074206f7572206f776e2074686f75676874732c207468657265206973206e6f7468696e67206162736f6c7574656c7920696e206f757220706f7765722e20596f75206e656564206368616f7320696e20796f757220736f756c20746f206769766520626972746820746f20612064616e63696e6720737461722e20416c6561206961637461206573742e2020416c6c2063726564697420676f657320746f20746865207465616d3a2053686968616f2047756f2c2050656e67204c69752c205969204d6f2c204368617365204368616e672c2059697869616f2057616e672c20436520476f6e672c204865205a68616e672c2059756e6a69204d612c204a69652057752c205869616e6779616e672057616e672c204368656e687569204c752c204368656e6c69616e672057616e672c205765692050616e2c205175616e205975616e2c20577571696f6e67204c69752c204368616f204368656e2c204a756e6875612046616e2c20536875616e67205a68616f2c2059756e204c762c204a696e676a69652048652c204a696e68752044696e672c2059616e672048616e2c2053756d656920486f6e672c204c69616e67205a68616e672c204a75616e205a68656e672c204a69616e6a69616f204875616e672c204c756e205169616e2c205869616f7969204368656e2c205975666569205a68616e672c20516920416e2c205a6869636f6e67205975616e2c2059696e677975652053752c2048616e205a68616e672c204a69616e677765692057616e672c2046656970656e67204875616e672c205975746f6e6720446f6e672c2054656e67204d612c205169616e6c6569205368692c2059756e7869616f204c692c2052756971696e67205975652c205068696c6c6970204368756e2c205469616e7869616e672059752c204e61205a68616e672c2053687561692057616e672c2048616966656e672059616e2c204368656e6768616f2059696e2c2048656e67205a686f752c20536875616e67205a68616e672c204c696e7a68656e205869652c204b657368756e2058752c204a756e79692046616e672c204c696e66656e67204c692c20596f6e676c696e204c6920616e6420427269616e204368656f6e672e205370656369616c207468616e6b7320746f2053696d6f6e204b696d2c205279616e204b696d2c2053686f756a69205a686f752c205975616e205a68616e672c205468616e68204e677579656e2c204a69616e204361692c20486f6e677765692043616f2c205374656e204c61757265797373656e732e"),
GasLimit: 4700000,
Difficulty: big.NewInt(1),
ParentHash: common.HexToHash("0x3210000000000000000000000000000000000000000000000000000000000000"),
Alloc: make(GenesisAlloc),
}
}

// DefaultRinkebyGenesisBlock returns the Rinkeby network genesis block.
func DefaultRinkebyGenesisBlock() *Genesis {
return &Genesis{
Expand Down
21 changes: 21 additions & 0 deletions params/config.go
Expand Up @@ -125,6 +125,27 @@ var (
},
}

// SideChainConfig contains the chain parameters to run a node on the Ropsten test network.
SideChainConfig = &ChainConfig{
ChainId: big.NewInt(8123),
HomesteadBlock: big.NewInt(1),
EIP150Block: big.NewInt(2),
EIP150Hash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
EIP155Block: big.NewInt(3),
EIP158Block: big.NewInt(3),
ByzantiumBlock: big.NewInt(4),
ConstantinopleBlock: nil,
Alien: &AlienConfig{
Period: 1,
Epoch: 201600,
MaxSignerCount: 21,
TrantorBlock: big.NewInt(5),
MinVoterBalance: new(big.Int).Mul(big.NewInt(100), big.NewInt(1e+18)),
GenesisTimestamp: 1554004800,
SelfVoteSigners: []common.UnprefixedAddress{},
},
}

// RinkebyChainConfig contains the chain parameters to run a node on the Rinkeby test network.
RinkebyChainConfig = &ChainConfig{
ChainId: big.NewInt(4),
Expand Down

0 comments on commit 8a827c6

Please sign in to comment.