initCommand=cli.Command{Action:utils.MigrateFlags(initGenesis),Name:"init",Usage:"Bootstrap and initialize a new genesis block",ArgsUsage:"<genesisPath>",Flags:[]cli.Flag{utils.DataDirFlag,utils.LightModeFlag,},Category:"BLOCKCHAIN COMMANDS",Description:`The init command initializes a new genesis block and definition for the network.This is a destructive action and changes the network in which you will beparticipating.It expects the genesis file as argument.`,}
startNode boots up the system node and all registered protocols, after which it unlocks any requested accounts, and starts the RPC/IPC interfaces and the miner.
func CreateConsensusEngine(ctx *node.ServiceContext, config *Config, chainConfig *params.ChainConfig, db ethdb.Database) consensus.Engine {
// If proof-of-authority is requested, set it up
if chainConfig.Clique != nil {
return clique.New(chainConfig.Clique, db)
}
// Otherwise assume proof-of-work
switch {
case config.PowFake:
log.Warn("Ethash used in fake mode")
return ethash.NewFaker()
case config.PowTest:
log.Warn("Ethash used in test mode")
return ethash.NewTester()
case config.PowShared:
log.Warn("Ethash used in shared mode")
return ethash.NewShared()
default:
engine := ethash.New(ctx.ResolvePath(config.EthashCacheDir), config.EthashCachesInMem, config.EthashCachesOnDisk,
config.EthashDatasetDir, config.EthashDatasetsInMem, config.EthashDatasetsOnDisk)
engine.SetThreads(-1) // Disable CPU mining
return engine
}
}