Skip to content

Commit 64789fb

Browse files
committed
cmd/*, core, params: add ottoman testnet
1 parent da8845e commit 64789fb

File tree

7 files changed

+63
-2
lines changed

7 files changed

+63
-2
lines changed

cmd/geth/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ var (
102102
utils.DevModeFlag,
103103
utils.TestnetFlag,
104104
utils.RinkebyFlag,
105+
utils.OttomanFlag,
105106
utils.VMEnableDebugFlag,
106107
utils.NetworkIdFlag,
107108
utils.RPCCORSDomainFlag,

cmd/geth/usage.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ var AppHelpFlagGroups = []flagGroup{
7272
utils.NetworkIdFlag,
7373
utils.TestnetFlag,
7474
utils.RinkebyFlag,
75+
utils.OttomanFlag,
7576
utils.DevModeFlag,
7677
utils.SyncModeFlag,
7778
utils.EthStatsURLFlag,

cmd/utils/flags.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ var (
124124
}
125125
NetworkIdFlag = cli.Uint64Flag{
126126
Name: "networkid",
127-
Usage: "Network identifier (integer, 1=Frontier, 2=Morden (disused), 3=Ropsten, 4=Rinkeby)",
127+
Usage: "Network identifier (integer, 1=Frontier, 2=Morden (disused), 3=Ropsten, 4=Rinkeby, 5=Ottoman)",
128128
Value: eth.DefaultConfig.NetworkId,
129129
}
130130
TestnetFlag = cli.BoolFlag{
@@ -135,6 +135,10 @@ var (
135135
Name: "rinkeby",
136136
Usage: "Rinkeby network: pre-configured proof-of-authority test network",
137137
}
138+
OttomanFlag = cli.BoolFlag{
139+
Name: "ottoman",
140+
Usage: "Ottoman network: pre-configured istanbul bft test network",
141+
}
138142
DevModeFlag = cli.BoolFlag{
139143
Name: "dev",
140144
Usage: "Developer mode: pre-configured private network with several debugging flags",
@@ -515,6 +519,9 @@ func MakeDataDir(ctx *cli.Context) string {
515519
if ctx.GlobalBool(RinkebyFlag.Name) {
516520
return filepath.Join(path, "rinkeby")
517521
}
522+
if ctx.GlobalBool(OttomanFlag.Name) {
523+
return filepath.Join(path, "ottoman")
524+
}
518525
return path
519526
}
520527
Fatalf("Cannot determine default data directory, please set manually (--datadir)")
@@ -569,6 +576,8 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
569576
urls = params.TestnetBootnodes
570577
case ctx.GlobalBool(RinkebyFlag.Name):
571578
urls = params.RinkebyBootnodes
579+
case ctx.GlobalBool(OttomanFlag.Name):
580+
urls = params.OttomanBootnodes
572581
}
573582

574583
cfg.BootstrapNodes = make([]*discover.Node, 0, len(urls))
@@ -838,6 +847,8 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
838847
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "testnet")
839848
case ctx.GlobalBool(RinkebyFlag.Name):
840849
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "rinkeby")
850+
case ctx.GlobalBool(OttomanFlag.Name):
851+
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "ottoman")
841852
}
842853

843854
if ctx.GlobalIsSet(KeyStoreDirFlag.Name) {
@@ -951,7 +962,7 @@ func SetShhConfig(ctx *cli.Context, stack *node.Node, cfg *whisper.Config) {
951962
// SetEthConfig applies eth-related command line flags to the config.
952963
func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
953964
// Avoid conflicting network flags
954-
checkExclusive(ctx, DevModeFlag, TestnetFlag, RinkebyFlag)
965+
checkExclusive(ctx, DevModeFlag, TestnetFlag, RinkebyFlag, OttomanFlag)
955966
checkExclusive(ctx, FastSyncFlag, LightModeFlag, SyncModeFlag)
956967

957968
ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
@@ -1013,6 +1024,11 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
10131024
cfg.NetworkId = 4
10141025
}
10151026
cfg.Genesis = core.DefaultRinkebyGenesisBlock()
1027+
case ctx.GlobalBool(OttomanFlag.Name):
1028+
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
1029+
cfg.NetworkId = 5
1030+
}
1031+
cfg.Genesis = core.DefaultOttomanGenesisBlock()
10161032
case ctx.GlobalBool(DevModeFlag.Name):
10171033
cfg.Genesis = core.DevGenesisBlock()
10181034
if !ctx.GlobalIsSet(GasPriceFlag.Name) {
@@ -1105,6 +1121,8 @@ func MakeGenesis(ctx *cli.Context) *core.Genesis {
11051121
genesis = core.DefaultTestnetGenesisBlock()
11061122
case ctx.GlobalBool(RinkebyFlag.Name):
11071123
genesis = core.DefaultRinkebyGenesisBlock()
1124+
case ctx.GlobalBool(OttomanFlag.Name):
1125+
genesis = core.DefaultOttomanGenesisBlock()
11081126
case ctx.GlobalBool(DevModeFlag.Name):
11091127
genesis = core.DevGenesisBlock()
11101128
}

core/genesis.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,19 @@ func DefaultRinkebyGenesisBlock() *Genesis {
342342
}
343343
}
344344

345+
// DefaultOttomanGenesisBlock returns the Ottoman network genesis block.
346+
func DefaultOttomanGenesisBlock() *Genesis {
347+
return &Genesis{
348+
Config: params.OttomanChainConfig,
349+
Timestamp: 1496993285,
350+
ExtraData: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000000f89af85494475cc98b5521ab2a1335683e7567c8048bfe79ed9407d8299de61faed3686ba4c4e6c3b9083d7e2371944fe035ce99af680d89e2c4d73aca01dbfc1bd2fd94dc421209441a754f79c4a4ecd2b49c935aad0312b8410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0"),
351+
GasLimit: 4700000,
352+
Difficulty: big.NewInt(1),
353+
Mixhash: common.HexToHash("0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365"),
354+
Alloc: decodePrealloc(ottomanAllocData),
355+
}
356+
}
357+
345358
// DevGenesisBlock returns the 'geth --dev' genesis block.
346359
func DevGenesisBlock() *Genesis {
347360
return &Genesis{

core/genesis_alloc.go

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

params/bootnodes.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ var RinkebyV5Bootnodes = []string{
5151
"enode://343149e4feefa15d882d9fe4ac7d88f885bd05ebb735e547f12e12080a9fa07c8014ca6fd7f373123488102fe5e34111f8509cf0b7de3f5b44339c9f25e87cb8@52.3.158.184:30303?discport=30304", // INFURA
5252
}
5353

54+
// Ottoman are the enode URLs of the P2P bootstrap nodes running on the
55+
// Ottoman test network.
56+
var OttomanBootnodes = []string{
57+
"enode://851ceb576681cf1e0d46ee9f049d6c678f229d806d1b41afe5b6d3c99a43fbbb7271d60e4c43cc5535e125a61db4ea2424823a3ad2c5959e8125f546cd1a7969@13.76.136.158:30303", //SG
58+
"enode://e3b5624752b86b60aa492edd65bdc906f9861a5e9113abd8f908443d1f64395c0e2bdd2e1825154837fd72da9d2e55e4f231411d5ca99ba9c90e14ba2f5612f6@52.163.118.231:30303", //SG
59+
"enode://3a1c96fe1fe9da5d4ea3b1a65bfecb4571101b519595cab6deb2eb029209353cdbc91c8d3751d0c6c00e5440657b678508e99bd9e934d4a0c1ad553fc1cb9155@13.76.140.250:30303", //SG
60+
"enode://aebe74e4ab7db8074d1cb9634dab3fd8c5745f8cc4868da2007ff754721085b189ffaf44b8041219de90b55df3ac515bbd0e1df7fde8d7684df0ecfb12534a73@52.187.45.126:30303", //SG
61+
}
62+
5463
// DiscoveryV5Bootnodes are the enode URLs of the P2P bootstrap nodes for the
5564
// experimental RLPx v5 topic-discovery network.
5665
var DiscoveryV5Bootnodes = []string{

params/config.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,24 @@ var (
7878
},
7979
}
8080

81+
// OttomanChainConfig contains the chain parameters to run a node on the Ottoman test network.
82+
OttomanChainConfig = &ChainConfig{
83+
ChainId: big.NewInt(5),
84+
HomesteadBlock: big.NewInt(1),
85+
DAOForkBlock: nil,
86+
DAOForkSupport: true,
87+
EIP150Block: big.NewInt(2),
88+
EIP150Hash: common.HexToHash("0x9b095b36c15eaf13044373aef8ee0bd3a382a5abb92e402afa44b8249c3a90e9"),
89+
EIP155Block: big.NewInt(3),
90+
EIP158Block: big.NewInt(3),
91+
ByzantiumBlock: big.NewInt(math.MaxInt64), // Don't enable yet
92+
93+
Istanbul: &IstanbulConfig{
94+
Epoch: 30000,
95+
ProposerPolicy: 0,
96+
},
97+
}
98+
8199
// AllProtocolChanges contains every protocol change (EIPs)
82100
// introduced and accepted by the Ethereum core developers.
83101
//

0 commit comments

Comments
 (0)