Skip to content

Commit

Permalink
chore: add goat mainnet
Browse files Browse the repository at this point in the history
  • Loading branch information
ericlee42 committed Dec 2, 2024
1 parent f9fd6cd commit a42bdff
Show file tree
Hide file tree
Showing 4 changed files with 228 additions and 11 deletions.
8 changes: 6 additions & 2 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -1055,8 +1055,10 @@ func setBootstrapNodesV5(ctx *cli.Context, cfg *p2p.Config) {
case ctx.IsSet(GoatNetworkFlag.Name):
goatNetwork := ctx.String(GoatNetworkFlag.Name)
switch goatNetwork {
case "testnet3":
case params.GoatTestnet3Name:
urls = params.V5GoatTestnet3Bootnodes
case params.GoatMainnetName:
urls = params.V5GoatMainnetBootnodes
}
}

Expand Down Expand Up @@ -2163,8 +2165,10 @@ func MakeGenesis(ctx *cli.Context) *core.Genesis {
case ctx.IsSet(GoatNetworkFlag.Name):
netwk := ctx.String(GoatNetworkFlag.Name)
switch netwk {
case "testnet3":
case params.GoatTestnet3Name:
genesis = core.DefaultGoatTestnet3GenesisBlock()
case params.GoatMainnetName:
genesis = core.DefaultGoatMainnetGenesisBlock()
default:
Fatalf("unknown goat network: %s", netwk)
}
Expand Down
26 changes: 25 additions & 1 deletion core/genesis_goat.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import (
//go:embed goat
var goatGenesis embed.FS

var goatEmptyExtra = common.Hex2Bytes("0056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421")

// DefaultGoatTestnet3GenesisBlock returns the Goat Testnet3 genesis block.
func DefaultGoatTestnet3GenesisBlock() *Genesis {
raw, err := goatGenesis.ReadFile("goat/testnet3.json")
Expand All @@ -29,7 +31,29 @@ func DefaultGoatTestnet3GenesisBlock() *Genesis {
Config: params.GoatTestnet3ChainConfig,
Nonce: 0,
Timestamp: 0x67345ba0,
ExtraData: common.Hex2Bytes("0056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"),
ExtraData: goatEmptyExtra,
GasLimit: params.GoatTxGasLimit,
Difficulty: common.Big0,
Alloc: alloc,
BaseFee: big.NewInt(2028449),
}
}

// DefaultGoatMainnetGenesisBlock returns the Goat Mainnet genesis block.
func DefaultGoatMainnetGenesisBlock() *Genesis {
raw, err := goatGenesis.ReadFile("goat/mainnet.json")
if err != nil {
panic(err)
}
var alloc types.GenesisAlloc
if err := json.Unmarshal(raw, &alloc); err != nil {
panic(err)
}
return &Genesis{
Config: params.GoatMainnetChainConfig,
Nonce: 0,
Timestamp: 0x674d6b3a,
ExtraData: goatEmptyExtra,
GasLimit: params.GoatTxGasLimit,
Difficulty: common.Big0,
Alloc: alloc,
Expand Down
151 changes: 151 additions & 0 deletions core/goat/mainnet.json

Large diffs are not rendered by default.

54 changes: 46 additions & 8 deletions params/goat.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,54 @@ const (
GoatTxGasLimit = 30_000_000 // the goat tx gas limit, it's the same with eth system tx
)

var V5GoatTestnet3Bootnodes = []string{
// MetisDAO
"enode://ea55fed4d513969ec6048d089d108b12c75610fa808416d7b7a3b1e443113effc7b473f03396be2bfd238b2abef47b454e2da8c8f4da49f7dbd49470efc3efa1@3.222.213.223:30303",
// ZKM
"enode://25fde2ca58a45a561a52b3cae2b0e56b1838f149ba5f7af88e4dc6f76a2647c0f7dd383cc21e744d72bf27f6db9e2ce61eb412e3e9cf9401b8a5be57ec6e4952@54.68.179.184:30303",
// Goat
"enode://a7106c2ddce59458bc25cff89812b464db1cd5ca8db6d2045326d60f4b918bb6f74e192ed36e108f4821a499066c06abd51b4905350fa2dc87634286a5872102@52.32.82.160:30303",
}
const (
GoatMainnetName = "mainnet"
GoatTestnet3Name = "testnet3"
)

var (
V5GoatTestnet3Bootnodes = []string{
// MetisDAO
"enode://ea55fed4d513969ec6048d089d108b12c75610fa808416d7b7a3b1e443113effc7b473f03396be2bfd238b2abef47b454e2da8c8f4da49f7dbd49470efc3efa1@3.222.213.223:30303",
// ZKM
"enode://25fde2ca58a45a561a52b3cae2b0e56b1838f149ba5f7af88e4dc6f76a2647c0f7dd383cc21e744d72bf27f6db9e2ce61eb412e3e9cf9401b8a5be57ec6e4952@54.68.179.184:30303",
// Goat
"enode://a7106c2ddce59458bc25cff89812b464db1cd5ca8db6d2045326d60f4b918bb6f74e192ed36e108f4821a499066c06abd51b4905350fa2dc87634286a5872102@52.32.82.160:30303",
}

V5GoatMainnetBootnodes = []string{
// MetisDAO
"enode://8411fdcbadc4ef56e99d937e6549e81fc665fa7dcf89b27936444ed3d8f866b0a48916a4f63dfedc0c51cb2f0ea6799b8eccea5d0914d27b0b214efe937a4812@18.222.86.233:30303",
// ZKM
"enode://c32ed98a51343e96dd7f2c6efdc8f621bc98d44e7350647b7d6d0f8aac27a89614f8f7b266f5d26619792da751b30ab3181e6b85655b7af3fa3853c040a2ff04@3.14.116.76:30303",
// Goat
"enode://02aacb270446f09566bc5f26a1edb1b30815c1d0cec3774d3e1d667abb6ac7f712e00c0b4a3f421a7bfc5da75b2ff1e30adc78a156bdc0e5ce62ca0deea4209d@18.221.14.115:30303",
}
)

var (
// GoatMainnetChainConfig contains the chain parameters to run a node on the Goat Mainnet network.
GoatMainnetChainConfig = &ChainConfig{
ChainID: big.NewInt(2345),
HomesteadBlock: common.Big0,
EIP150Block: common.Big0,
EIP155Block: common.Big0,
EIP158Block: common.Big0,
ByzantiumBlock: common.Big0,
ConstantinopleBlock: common.Big0,
PetersburgBlock: common.Big0,
IstanbulBlock: common.Big0,
MuirGlacierBlock: common.Big0,
BerlinBlock: common.Big0,
LondonBlock: common.Big0,
ArrowGlacierBlock: common.Big0,
GrayGlacierBlock: common.Big0,
ShanghaiTime: newUint64(0),
CancunTime: newUint64(0),
TerminalTotalDifficulty: common.Big0,
Goat: &GoatConfig{},
}

// GoatTestnet3ChainConfig contains the chain parameters to run a node on the Goat Testnet3 network.
GoatTestnet3ChainConfig = &ChainConfig{
ChainID: big.NewInt(48816),
Expand Down

0 comments on commit a42bdff

Please sign in to comment.