cmn "github.com/tendermint/tmlibs/common"
"github.com/bytom/types"
+ cfg "github.com/bytom/config"
"github.com/bytom/crypto/ed25519/chainkd"
)
}
func init() {
+ initFilesCmd.Flags().String("chain_id", config.ChainID, "Select [mainnet] or [testnet]")
+
RootCmd.AddCommand(initFilesCmd)
}
func initFiles(cmd *cobra.Command, args []string) {
+ if config.ChainID == "mainnet" {
+ cfg.EnsureRoot(config.RootDir, "mainnet")
+ } else {
+ cfg.EnsureRoot(config.RootDir, "testnet")
+ }
+
genFile := config.GenesisFile()
if _, err := os.Stat(genFile); !os.IsNotExist(err) {
log.WithField("genesis", config.GenesisFile()).Info("Already exits config file.")
return
}
genDoc := types.GenesisDoc{
- ChainID: cmn.Fmt("bytom"),
+ ChainID: cmn.Fmt(config.ChainID),
PrivateKey: hex.EncodeToString(xprv.Bytes()),
}
genDoc.SaveAs(genFile)