diff --git a/cmd/clef/README.md b/cmd/clef/README.md index 27c62817..5c1acdb0 100644 --- a/cmd/clef/README.md +++ b/cmd/clef/README.md @@ -29,7 +29,7 @@ GLOBAL OPTIONS: --loglevel value log level to emit to the screen (default: 4) --keystore value Directory for the keystore (default: "$HOME/.ethereum/keystore") --configdir value Directory for Clef configuration (default: "$HOME/.clef") - --chainid value Chain id to use for signing (1=mainnet, 3=Ropsten, 4=Rinkeby, 5=Goerli) (default: 1) + --chainid value Chain id to use for signing (1=mainnet, 3=Ropsten, 4=Rinkeby, 5=Goerli, 12345=Lve, 12346=Lvetest)" (default: 1) --lightkdf Reduce key-derivation RAM & CPU usage at some expense of KDF strength --nousb Disables monitoring for and managing USB hardware wallets --pcscdpath value Path to the smartcard daemon (pcscd) socket file (default: "/run/pcscd/pcscd.comm") diff --git a/cmd/clef/main.go b/cmd/clef/main.go index 05290f52..18326a54 100644 --- a/cmd/clef/main.go +++ b/cmd/clef/main.go @@ -98,7 +98,7 @@ var ( chainIdFlag = &cli.Int64Flag{ Name: "chainid", Value: params.MainnetChainConfig.ChainID.Int64(), - Usage: "Chain id to use for signing (1=mainnet, 3=Ropsten, 4=Rinkeby, 5=Goerli)", + Usage: "Chain id to use for signing (1=mainnet, 3=Ropsten, 4=Rinkeby, 5=Goerli, 12345=Lve, 12346=Lvetest)", } rpcPortFlag = &cli.IntFlag{ Name: "http.port", diff --git a/cmd/devp2p/README.md b/cmd/devp2p/README.md index 7f816b60..c4690db0 100644 --- a/cmd/devp2p/README.md +++ b/cmd/devp2p/README.md @@ -44,7 +44,7 @@ set to standard output. The following filters are supported: - `-limit ` limits the output set to N entries, taking the top N nodes by score - `-ip ` filters nodes by IP subnet - `-min-age ` filters nodes by 'first seen' time -- `-eth-network ` filters nodes by "eth" ENR entry +- `-eth-network ` filters nodes by "eth" ENR entry - `-les-server` filters nodes by LES server support - `-snap` filters nodes by snap protocol support diff --git a/cmd/devp2p/nodesetcmd.go b/cmd/devp2p/nodesetcmd.go index 2cf10459..aae5a14a 100644 --- a/cmd/devp2p/nodesetcmd.go +++ b/cmd/devp2p/nodesetcmd.go @@ -237,6 +237,10 @@ func ethFilter(args []string) (nodeFilter, error) { filter = forkid.NewStaticFilter(params.RopstenChainConfig, params.RopstenGenesisHash) case "sepolia": filter = forkid.NewStaticFilter(params.SepoliaChainConfig, params.SepoliaGenesisHash) + case "lve": + filter = forkid.NewStaticFilter(params.LveChainConfig, params.LveGenesisHash) + case "lvetest": + filter = forkid.NewStaticFilter(params.LvetestChainConfig, params.LvetestGenesisHash) default: return nil, fmt.Errorf("unknown network %q", args[0]) } diff --git a/cmd/evm/main.go b/cmd/evm/main.go index 994b6436..fda901bd 100644 --- a/cmd/evm/main.go +++ b/cmd/evm/main.go @@ -185,6 +185,7 @@ var blockBuilderCommand = &cli.Command{ t8ntool.InputOmmersFlag, t8ntool.InputTxsRlpFlag, t8ntool.SealCliqueFlag, + t8ntool.SealEccpowFlag, t8ntool.SealEthashFlag, t8ntool.SealEthashDirFlag, t8ntool.SealEthashModeFlag, diff --git a/cmd/evm/testdata/21/readme.md b/cmd/evm/testdata/21/readme.md index b70f106f..477710fa 100644 --- a/cmd/evm/testdata/21/readme.md +++ b/cmd/evm/testdata/21/readme.md @@ -21,3 +21,5 @@ $ go run . b11r --input.header=testdata/21/header.json --input.txs=testdata/21/t "hash": "0x71c59102cc805dbe8741e1210ebe229a321eff144ac7276006fefe39e8357dc7" } ``` + +## Eccpow(working...) diff --git a/cmd/faucet/faucet.go b/cmd/faucet/faucet.go index dfb7d326..9a9f33dc 100644 --- a/cmd/faucet/faucet.go +++ b/cmd/faucet/faucet.go @@ -87,6 +87,9 @@ var ( goerliFlag = flag.Bool("goerli", false, "Initializes the faucet with Görli network config") rinkebyFlag = flag.Bool("rinkeby", false, "Initializes the faucet with Rinkeby network config") sepoliaFlag = flag.Bool("sepolia", false, "Initializes the faucet with Sepolia network config") + + //lveFlag = flag.Bool("lve", false, "Initializes the faucet with Lve network config") + //lvetestFlag = flag.Bool("lvetest", false, "Initializes the faucet with Lvetest network config") ) var ( diff --git a/cmd/geth/main.go b/cmd/geth/main.go index b9e3ed31..efddc3f5 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -290,6 +290,12 @@ func prepare(ctx *cli.Context) { case ctx.IsSet(utils.KilnFlag.Name): log.Info("Starting Geth on Kiln testnet...") + case ctx.IsSet(utils.LveFlag.Name): + log.Info("Starting Geth on Lve ...") + + case ctx.IsSet(utils.LvetestFlag.Name): + log.Info("Starting Geth on Lve testnet...") + case ctx.IsSet(utils.DeveloperFlag.Name): log.Info("Starting Geth in ephemeral dev mode...") log.Warn(`You are running Geth in --dev mode. Please note the following: @@ -319,6 +325,8 @@ func prepare(ctx *cli.Context) { !ctx.IsSet(utils.RinkebyFlag.Name) && !ctx.IsSet(utils.GoerliFlag.Name) && !ctx.IsSet(utils.KilnFlag.Name) && + !ctx.IsSet(utils.LveFlag.Name) && + !ctx.IsSet(utils.LvetestFlag.Name) && !ctx.IsSet(utils.DeveloperFlag.Name) { // Nope, we're really on mainnet. Bump that cache up! log.Info("Bumping default cache on mainnet", "provided", ctx.Int(utils.CacheFlag.Name), "updated", 4096) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index c26d9087..fae428df 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -997,10 +997,12 @@ var ( GoerliFlag, SepoliaFlag, KilnFlag, + LvetestFlag, } // NetworkFlags is the flag group of all built-in supported networks. NetworkFlags = append([]cli.Flag{ MainnetFlag, + LveFlag, }, TestnetFlags...) // DatabasePathFlags is the flag group of all database path flags. @@ -1033,6 +1035,12 @@ func MakeDataDir(ctx *cli.Context) string { if ctx.Bool(KilnFlag.Name) { return filepath.Join(path, "kiln") } + if ctx.Bool(LveFlag.Name) { + return filepath.Join(path, "lve") + } + if ctx.Bool(LvetestFlag.Name) { + return filepath.Join(path, "lvetest") + } return path } Fatalf("Cannot determine default data directory, please set manually (--datadir)") @@ -1089,6 +1097,10 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) { urls = params.GoerliBootnodes case ctx.Bool(KilnFlag.Name): urls = params.KilnBootnodes + case ctx.Bool(LveFlag.Name): + urls = params.LveBootnodes + case ctx.Bool(LvetestFlag.Name): + urls = params.LvetestBootnodes } // don't apply defaults if BootstrapNodes is already set @@ -1547,6 +1559,10 @@ func SetDataDir(ctx *cli.Context, cfg *node.Config) { cfg.DataDir = filepath.Join(node.DefaultDataDir(), "sepolia") case ctx.Bool(KilnFlag.Name) && cfg.DataDir == node.DefaultDataDir(): cfg.DataDir = filepath.Join(node.DefaultDataDir(), "kiln") + case ctx.Bool(LveFlag.Name) && cfg.DataDir == node.DefaultDataDir(): + cfg.DataDir = filepath.Join(node.DefaultDataDir(), "lve") + case ctx.Bool(LvetestFlag.Name) && cfg.DataDir == node.DefaultDataDir(): + cfg.DataDir = filepath.Join(node.DefaultDataDir(), "lvetest") } } @@ -1737,7 +1753,7 @@ func CheckExclusive(ctx *cli.Context, args ...interface{}) { // SetEthConfig applies eth-related command line flags to the config. func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { // Avoid conflicting network flags - CheckExclusive(ctx, MainnetFlag, DeveloperFlag, RopstenFlag, RinkebyFlag, GoerliFlag, SepoliaFlag, KilnFlag) + CheckExclusive(ctx, MainnetFlag, DeveloperFlag, RopstenFlag, RinkebyFlag, GoerliFlag, SepoliaFlag, KilnFlag, LveFlag, LvetestFlag) CheckExclusive(ctx, LightServeFlag, SyncModeFlag, "light") CheckExclusive(ctx, DeveloperFlag, ExternalSignerFlag) // Can't use both ephemeral unlocked and external signer if ctx.String(GCModeFlag.Name) == "archive" && ctx.Uint64(TxLookupLimitFlag.Name) != 0 { @@ -1918,6 +1934,18 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { } cfg.Genesis = core.DefaultKilnGenesisBlock() SetDNSDiscoveryDefaults(cfg, params.KilnGenesisHash) + case ctx.Bool(LveFlag.Name): + if !ctx.IsSet(NetworkIdFlag.Name) { + cfg.NetworkId = 12345 + } + cfg.Genesis = core.DefaultLveGenesisBlock() + SetDNSDiscoveryDefaults(cfg, params.LveGenesisHash) + case ctx.Bool(LvetestFlag.Name): + if !ctx.IsSet(NetworkIdFlag.Name) { + cfg.NetworkId = 12346 + } + cfg.Genesis = core.DefaultLvetestGenesisBlock() + SetDNSDiscoveryDefaults(cfg, params.LvetestGenesisHash) case ctx.Bool(DeveloperFlag.Name): if !ctx.IsSet(NetworkIdFlag.Name) { cfg.NetworkId = 1337 @@ -2169,6 +2197,10 @@ func MakeGenesis(ctx *cli.Context) *core.Genesis { genesis = core.DefaultGoerliGenesisBlock() case ctx.Bool(KilnFlag.Name): genesis = core.DefaultKilnGenesisBlock() + case ctx.Bool(LveFlag.Name): + genesis = core.DefaultLveGenesisBlock() + case ctx.Bool(LvetestFlag.Name): + genesis = core.DefaultLvetestGenesisBlock() case ctx.Bool(DeveloperFlag.Name): Fatalf("Developer chains are ephemeral") } diff --git a/core/genesis.go b/core/genesis.go index 5b5b9c72..009e935a 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -160,6 +160,10 @@ func CommitGenesisState(db ethdb.Database, hash common.Hash) error { genesis = DefaultGoerliGenesisBlock() case params.SepoliaGenesisHash: genesis = DefaultSepoliaGenesisBlock() + case params.LveGenesisHash: + genesis = DefaultLveGenesisBlock() + case params.LvetestGenesisHash: + genesis = DefaultLvetestGenesisBlock() } if genesis != nil { alloc = genesis.Alloc @@ -398,6 +402,10 @@ func (g *Genesis) configOrDefault(ghash common.Hash) *params.ChainConfig { return params.GoerliChainConfig case ghash == params.KilnGenesisHash: return DefaultKilnGenesisBlock().Config + case ghash == params.LveGenesisHash: + return params.LveChainConfig + case ghash == params.LvetestGenesisHash: + return params.LvetestChainConfig default: return params.AllEthashProtocolChanges } @@ -554,6 +562,306 @@ func DefaultKilnGenesisBlock() *Genesis { return g } +// DefaultlveGenesisBlock returns the LVE network genesis block. +//change!! +func DefaultLveGenesisBlock() *Genesis { + return &Genesis{ + Config: params.LveChainConfig, + Nonce: 0, + Timestamp: 1651123670, + ExtraData: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000000"), + GasLimit: 4700000, + Difficulty: big.NewInt(524288), + Mixhash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"), + Coinbase: common.HexToAddress("0x0000000000000000000000000000000000000000"), + Number: 0, + GasUsed: 0, + ParentHash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"), + Alloc: map[common.Address]GenesisAccount{ + common.BytesToAddress([]byte{0}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{1}): {Balance: big.NewInt(1)}, // ECRecover + common.BytesToAddress([]byte{2}): {Balance: big.NewInt(1)}, // SHA256 + common.BytesToAddress([]byte{3}): {Balance: big.NewInt(1)}, // RIPEMD + common.BytesToAddress([]byte{4}): {Balance: big.NewInt(1)}, // Identity + common.BytesToAddress([]byte{5}): {Balance: big.NewInt(1)}, // ModExp + common.BytesToAddress([]byte{6}): {Balance: big.NewInt(1)}, // ECAdd + common.BytesToAddress([]byte{7}): {Balance: big.NewInt(1)}, // ECScalarMul + common.BytesToAddress([]byte{8}): {Balance: big.NewInt(1)}, // ECPairing + common.BytesToAddress([]byte{8}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{9}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{10}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{11}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{12}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{13}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{14}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{15}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{16}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{17}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{18}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{19}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{20}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{21}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{22}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{23}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{24}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{25}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{26}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{27}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{28}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{29}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{30}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{31}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{32}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{33}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{34}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{35}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{36}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{37}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{38}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{39}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{40}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{41}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{42}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{43}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{44}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{45}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{46}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{47}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{48}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{49}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{50}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{51}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{52}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{53}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{54}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{55}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{56}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{57}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{58}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{59}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{60}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{61}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{62}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{63}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{64}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{65}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{66}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{67}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{68}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{69}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{70}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{71}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{72}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{73}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{74}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{75}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{76}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{77}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{78}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{79}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{80}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{81}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{82}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{83}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{84}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{85}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{86}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{87}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{88}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{89}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{90}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{91}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{92}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{93}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{94}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{95}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{96}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{97}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{98}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{99}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{100}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{101}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{102}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{103}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{104}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{105}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{106}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{107}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{108}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{109}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{110}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{111}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{112}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{113}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{114}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{115}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{116}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{117}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{118}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{119}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{120}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{121}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{122}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{123}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{124}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{125}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{126}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{127}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{128}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{129}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{130}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{131}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{132}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{133}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{134}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{135}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{136}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{137}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{138}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{139}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{140}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{141}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{142}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{143}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{144}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{145}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{146}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{147}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{148}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{149}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{150}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{151}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{152}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{153}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{154}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{155}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{156}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{157}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{158}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{159}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{160}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{161}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{162}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{163}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{164}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{165}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{166}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{167}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{168}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{169}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{170}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{171}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{172}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{173}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{174}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{175}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{176}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{177}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{178}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{179}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{180}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{181}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{182}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{183}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{184}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{185}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{186}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{187}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{188}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{189}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{190}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{191}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{192}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{193}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{194}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{195}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{196}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{197}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{198}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{199}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{200}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{201}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{202}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{203}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{204}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{205}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{206}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{207}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{208}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{209}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{210}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{211}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{212}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{213}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{214}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{215}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{216}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{217}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{218}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{219}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{220}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{221}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{222}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{223}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{224}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{225}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{226}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{227}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{228}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{229}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{230}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{231}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{232}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{233}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{234}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{235}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{236}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{237}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{238}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{239}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{240}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{241}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{242}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{243}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{244}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{245}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{246}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{247}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{248}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{249}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{250}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{251}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{252}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{253}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{254}): {Balance: big.NewInt(1)}, + common.BytesToAddress([]byte{255}): {Balance: big.NewInt(1)}, + }, + } +} + +// DefaultLveGenesisBlock returns the LVE TEST network genesis block. +func DefaultLvetestGenesisBlock() *Genesis { + return &Genesis{ + Config: params.LvetestChainConfig, + Timestamp: 1643853426, + ExtraData: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000000"), + GasLimit: 4700000, + Difficulty: big.NewInt(524288), + Alloc: map[common.Address]GenesisAccount{ + common.BytesToAddress([]byte{1}): {Balance: big.NewInt(1)}, // ECRecover + common.BytesToAddress([]byte{2}): {Balance: big.NewInt(1)}, // SHA256 + common.BytesToAddress([]byte{3}): {Balance: big.NewInt(1)}, // RIPEMD + common.BytesToAddress([]byte{4}): {Balance: big.NewInt(1)}, // Identity + common.BytesToAddress([]byte{5}): {Balance: big.NewInt(1)}, // ModExp + common.BytesToAddress([]byte{6}): {Balance: big.NewInt(1)}, // ECAdd + common.BytesToAddress([]byte{7}): {Balance: big.NewInt(1)}, // ECScalarMul + common.BytesToAddress([]byte{8}): {Balance: big.NewInt(1)}, // ECPairing + }, + } +} + + + // DeveloperGenesisBlock returns the 'geth --dev' genesis block. func DeveloperGenesisBlock(period uint64, gasLimit uint64, faucet common.Address) *Genesis { // Override the default period to the user requested one diff --git a/eth/backend.go b/eth/backend.go index dca96e4f..ffce38dd 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -135,12 +135,13 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { } // Transfer mining-related config to the ethash config. ethashConfig := config.Ethash + eccpowConfig := config.Eccpow ethashConfig.NotifyFull = config.Miner.NotifyFull cliqueConfig, err := core.LoadCliqueConfig(chainDb, config.Genesis) if err != nil { return nil, err } - engine := ethconfig.CreateConsensusEngine(stack, ðashConfig, cliqueConfig, config.Miner.Notify, config.Miner.Noverify, chainDb) + engine := ethconfig.CreateConsensusEngine(stack, ðashConfig, cliqueConfig, eccpowConfig, config.Miner.Notify, config.Miner.Noverify, chainDb) eth := &Ethereum{ config: config, diff --git a/les/client.go b/les/client.go index 6e6beeb0..df1c5acb 100644 --- a/les/client.go +++ b/les/client.go @@ -128,7 +128,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*LightEthereum, error) { reqDist: newRequestDistributor(peers, &mclock.System{}), accountManager: stack.AccountManager(), merger: merger, - engine: ethconfig.CreateConsensusEngine(stack, &config.Ethash, chainConfig.Clique, nil, false, chainDb), + engine: ethconfig.CreateConsensusEngine(stack, &config.Ethash, chainConfig.Clique, &config.Ethash, nil, false, chainDb), bloomRequests: make(chan chan *bloombits.Retrieval), bloomIndexer: core.NewBloomIndexer(chainDb, params.BloomBitsBlocksClient, params.HelperTrieConfirmations), p2pServer: stack.Server(), diff --git a/mobile/geth.go b/mobile/geth.go index 204e29c8..a8822570 100644 --- a/mobile/geth.go +++ b/mobile/geth.go @@ -187,6 +187,20 @@ func NewNode(datadir string, config *NodeConfig) (stack *Node, _ error) { config.EthereumNetworkID = 5 } } + + if config.EthereumGenesis == LveGenesis() { + genesis.Config = params.LveChainConfig + if config.EthereumNetworkID == 1 { + config.EthereumNetworkID = 12345 + } + } + + if config.EthereumGenesis == LvetestGenesis() { + genesis.Config = params.LvetestChainConfig + if config.EthereumNetworkID == 1 { + config.EthereumNetworkID = 12346 + } + } } // Register the Ethereum protocol if requested if config.EthereumEnabled { diff --git a/mobile/params.go b/mobile/params.go index 2f4240b2..91724e3c 100644 --- a/mobile/params.go +++ b/mobile/params.go @@ -68,6 +68,24 @@ func GoerliGenesis() string { return string(enc) } +// LveGenesis returns the JSON spec to use for the LVE network +func LveGenesis() string { + enc, err := json.Marshal(core.DefaultLveGenesisBlock()) + if err != nil { + panic(err) + } + return string(enc) +} + +// LvetestGenesis returns the JSON spec to use for the LVE TEST network +func LvetestGenesis() string { + enc, err := json.Marshal(core.DefaultLvetestGenesisBlock()) + if err != nil { + panic(err) + } + return string(enc) +} + // FoundationBootnodes returns the enode URLs of the P2P bootstrap nodes operated // by the foundation running the V5 discovery protocol. func FoundationBootnodes() *Enodes { diff --git a/params/bootnodes.go b/params/bootnodes.go index b8099777..584df050 100644 --- a/params/bootnodes.go +++ b/params/bootnodes.go @@ -58,6 +58,19 @@ var RinkebyBootnodes = []string{ "enode://b6b28890b006743680c52e64e0d16db57f28124885595fa03a562be1d2bf0f3a1da297d56b13da25fb992888fd556d4c1a27b1f39d531bde7de1921c90061cc6@159.89.28.211:30303", // AKASHA } +// LveBootnodes are the enode URLs of the P2P bootstrap nodes running on the +// Lve network. +var LveBootnodes = []string{ + "enode://cf4760feb2d6bc0f5622b301a7917b9ccae2aa46c20b03af4da20190c988a76557a7d6bfdcebd0361463019bd39a4fc9b017a974e0d7384ee23f76ddc25fe329@3.1.96.244:30301", +} + +// LvetestBootnodes are the enode URLs of the P2P bootstrap nodes running on the +// Lve test network. +var LvetestBootnodes = []string{ + +} + + // GoerliBootnodes are the enode URLs of the P2P bootstrap nodes running on the // Görli test network. var GoerliBootnodes = []string{ @@ -118,6 +131,10 @@ func KnownDNSNetwork(genesis common.Hash, protocol string) string { net = "goerli" case SepoliaGenesisHash: net = "sepolia" + case LveGenesisHash: + net = "lve" + case LvetestGenesisHash: + net = "lvetest" default: return "" } diff --git a/params/config.go b/params/config.go index d535d230..9dcf826b 100644 --- a/params/config.go +++ b/params/config.go @@ -33,6 +33,9 @@ var ( RinkebyGenesisHash = common.HexToHash("0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177") GoerliGenesisHash = common.HexToHash("0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a") KilnGenesisHash = common.HexToHash("0x51c7fe41be669f69c45c33a56982cbde405313342d9e2b00d7c91a7b284dd4f8") + + LveGenesisHash = common.HexToHash("0x7c5cb1a45d2424a2be1155c22979bbe384aff07810260041d5609a87bc3c58cc") + LvetestGenesisHash = common.HexToHash("0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3") ) // TrustedCheckpoints associates each known checkpoint with the genesis hash of @@ -43,6 +46,9 @@ var TrustedCheckpoints = map[common.Hash]*TrustedCheckpoint{ SepoliaGenesisHash: SepoliaTrustedCheckpoint, RinkebyGenesisHash: RinkebyTrustedCheckpoint, GoerliGenesisHash: GoerliTrustedCheckpoint, + + LveGenesisHash: LveTrustedCheckpoint, + LvetestGenesisHash: LvetestTrustedCheckpoint, } // CheckpointOracles associates each known checkpoint oracles with the genesis hash of @@ -52,6 +58,10 @@ var CheckpointOracles = map[common.Hash]*CheckpointOracleConfig{ RopstenGenesisHash: RopstenCheckpointOracle, RinkebyGenesisHash: RinkebyCheckpointOracle, GoerliGenesisHash: GoerliCheckpointOracle, + + //update + LveGenesisHash: LveCheckpointOracle, + LvetestGenesisHash: LvetestCheckpointOracle, } var ( @@ -264,6 +274,78 @@ var ( Threshold: 2, } + // LveChainConfig contains the chain parameters to run a node on the Görli test network. + LveChainConfig = &ChainConfig{ + ChainID: big.NewInt(12345), + HomesteadBlock: big.NewInt(0), + EIP150Block: big.NewInt(0), + EIP150Hash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"), + EIP155Block: big.NewInt(0), + EIP158Block: big.NewInt(0), + ByzantiumBlock: big.NewInt(0), + ConstantinopleBlock: big.NewInt(0), + PetersburgBlock: big.NewInt(0), + EccPoW: new(EccPoWConfig), + } + + // LveTrustedCheckpoint contains the light client trusted checkpoint for the Görli test network. + LveTrustedCheckpoint = &TrustedCheckpoint{ + SectionIndex: 32, + SectionHead: common.HexToHash("0x50eaedd8361fa9edd0ac2dec410310b9bdf67b963b60f3b1dce47f84b30670f9"), + CHTRoot: common.HexToHash("0x6504db73139f75ffa9102ae980e41b361cf3d5b66cea06c79cde9f457368820c"), + BloomRoot: common.HexToHash("0x7551ae027bb776252a20ded51ee2ff0cbfbd1d8d57261b9161cc1f2f80237001"), + } + + // LveCheckpointOracle contains a set of configs for the Lve test network oracle. + LveCheckpointOracle = &CheckpointOracleConfig{ + Address: common.HexToAddress("0x18CA0E045F0D772a851BC7e48357Bcaab0a0795D"), + Signers: []common.Address{ + common.HexToAddress("0x4769bcaD07e3b938B7f43EB7D278Bc7Cb9efFb38"), // Peter + common.HexToAddress("0x78d1aD571A1A09D60D9BBf25894b44e4C8859595"), // Martin + common.HexToAddress("0x286834935f4A8Cfb4FF4C77D5770C2775aE2b0E7"), // Zsolt + common.HexToAddress("0xb86e2B0Ab5A4B1373e40c51A7C712c70Ba2f9f8E"), // Gary + common.HexToAddress("0x0DF8fa387C602AE62559cC4aFa4972A7045d6707"), // Guillaume + }, + Threshold: 2, + } + + // LvetestChainConfig contains the chain parameters to run a node on the Görli test network. + LvetestChainConfig = &ChainConfig{ + ChainID: big.NewInt(12346), + HomesteadBlock: big.NewInt(0), + DAOForkBlock: nil, + DAOForkSupport: true, + EIP150Block: big.NewInt(0), + EIP155Block: big.NewInt(0), + EIP158Block: big.NewInt(0), + ByzantiumBlock: big.NewInt(0), + ConstantinopleBlock: big.NewInt(0), + PetersburgBlock: big.NewInt(0), + IstanbulBlock: nil, + EccPoW: new(EccPoWConfig), + } + + // LvetestTrustedCheckpoint contains the light client trusted checkpoint for the Görli test network. + LvetestTrustedCheckpoint = &TrustedCheckpoint{ + SectionIndex: 32, + SectionHead: common.HexToHash("0x50eaedd8361fa9edd0ac2dec410310b9bdf67b963b60f3b1dce47f84b30670f9"), + CHTRoot: common.HexToHash("0x6504db73139f75ffa9102ae980e41b361cf3d5b66cea06c79cde9f457368820c"), + BloomRoot: common.HexToHash("0x7551ae027bb776252a20ded51ee2ff0cbfbd1d8d57261b9161cc1f2f80237001"), + } + + // LvetestCheckpointOracle contains a set of configs for the Lve test network oracle. + LvetestCheckpointOracle = &CheckpointOracleConfig{ + Address: common.HexToAddress("0x18CA0E045F0D772a851BC7e48357Bcaab0a0795D"), + Signers: []common.Address{ + common.HexToAddress("0x4769bcaD07e3b938B7f43EB7D278Bc7Cb9efFb38"), // Peter + common.HexToAddress("0x78d1aD571A1A09D60D9BBf25894b44e4C8859595"), // Martin + common.HexToAddress("0x286834935f4A8Cfb4FF4C77D5770C2775aE2b0E7"), // Zsolt + common.HexToAddress("0xb86e2B0Ab5A4B1373e40c51A7C712c70Ba2f9f8E"), // Gary + common.HexToAddress("0x0DF8fa387C602AE62559cC4aFa4972A7045d6707"), // Guillaume + }, + Threshold: 2, + } + // AllEthashProtocolChanges contains every protocol change (EIPs) introduced // and accepted by the Ethereum core developers into the Ethash consensus. // @@ -290,6 +372,8 @@ var NetworkNames = map[string]string{ RinkebyChainConfig.ChainID.String(): "rinkeby", GoerliChainConfig.ChainID.String(): "goerli", SepoliaChainConfig.ChainID.String(): "sepolia", + LveChainConfig.ChainID.String(): "lve", + LvetestChainConfig.ChainID.String(): "lvetest", } // TrustedCheckpoint represents a set of post-processed trie roots (CHT and