6 log "github.com/sirupsen/logrus"
7 "github.com/spf13/cobra"
9 "github.com/bytom/node"
12 var runNodeCmd = &cobra.Command{
14 Short: "Run the bytomd",
19 runNodeCmd.Flags().String("prof_laddr", config.ProfListenAddress, "Use http to profile bytomd programs")
20 runNodeCmd.Flags().Bool("mining", config.Mining, "Enable mining")
22 runNodeCmd.Flags().Bool("auth.disable", config.Auth.Disable, "Disable rpc access authenticate")
24 runNodeCmd.Flags().Bool("wallet.disable", config.Wallet.Disable, "Disable wallet")
25 runNodeCmd.Flags().Bool("wallet.rescan", config.Wallet.Rescan, "Rescan wallet")
26 runNodeCmd.Flags().Bool("vault_mode", config.VaultMode, "Run in the offline enviroment")
27 runNodeCmd.Flags().Bool("web.closed", config.Web.Closed, "Lanch web browser or not")
28 runNodeCmd.Flags().String("chain_id", config.ChainID, "Select network type")
31 runNodeCmd.Flags().String("p2p.laddr", config.P2P.ListenAddress, "Node listen address. (0.0.0.0:0 means any interface, any port)")
32 runNodeCmd.Flags().String("p2p.seeds", config.P2P.Seeds, "Comma delimited host:port seed nodes")
33 runNodeCmd.Flags().Bool("p2p.skip_upnp", config.P2P.SkipUPNP, "Skip UPNP configuration")
34 runNodeCmd.Flags().Bool("p2p.pex", config.P2P.PexReactor, "Enable Peer-Exchange ")
35 runNodeCmd.Flags().Int("p2p.max_num_peers", config.P2P.MaxNumPeers, "Set max num peers")
36 runNodeCmd.Flags().Int("p2p.handshake_timeout", config.P2P.HandshakeTimeout, "Set handshake timeout")
37 runNodeCmd.Flags().Int("p2p.dial_timeout", config.P2P.DialTimeout, "Set dial timeout")
40 runNodeCmd.Flags().String("log_file", config.LogFile, "Log output file")
42 RootCmd.AddCommand(runNodeCmd)
45 func runNode(cmd *cobra.Command, args []string) error {
46 // Create & start node
47 n := node.NewNode(config)
48 if _, err := n.Start(); err != nil {
49 return fmt.Errorf("Failed to start node: %v", err)
51 log.Info("Start node ", n.SyncManager().NodeInfo())
54 // Trap signal, run forever.