func createWallet(cfg *config) error {
	dbDir := networkDir(cfg.AppDataDir.Value, activeNet.Params)
	stakeOptions := &loader.StakeOptions{
		VotingEnabled: cfg.EnableVoting,
		AddressReuse:  cfg.ReuseAddresses,
		TicketAddress: cfg.TicketAddress,
		TicketFee:     cfg.TicketFee.ToCoin(),
	}
	loader := loader.NewLoader(activeNet.Params, dbDir, stakeOptions,
		cfg.AddrIdxScanLen, cfg.AllowHighFees, cfg.RelayFee.ToCoin())
	reader := bufio.NewReader(os.Stdin)
	privPass, pubPass, seed, err := prompt.Setup(reader,
		[]byte(wallet.InsecurePubPassphrase), []byte(cfg.createPass), []byte(cfg.WalletPass))
	if err != nil {
		return err
	}
	fmt.Println("Creating the wallet...")
	_, err = loader.CreateNewWallet(pubPass, privPass, seed)
	if err != nil {
		return err
	}
	fmt.Println("The wallet has been created successfully.")
	return nil
}
createWallet prompts the user for information needed to generate a new wallet
and generates the wallet accordingly.  The new wallet will reside at the
provided path. The bool passed back gives whether or not the wallet was
restored from seed, while the []byte passed is the private password required
to do the initial sync.
package main
import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"
	"github.com/HcashOrg/hcashd/chaincfg"
	"github.com/HcashOrg/hcashd/wire"
	"github.com/HcashOrg/hcashutil/hdkeychain"
	"github.com/HcashOrg/hcashwallet/internal/prompt"
	"github.com/HcashOrg/hcashwallet/loader"
	"github.com/HcashOrg/hcashwallet/wallet"
	"github.com/HcashOrg/hcashwallet/walletdb"
	_ "github.com/HcashOrg/hcashwallet/walletdb/bdb"
	"github.com/HcashOrg/hcashwallet/walletseed"
)
func networkDir(dataDir string, chainParams *chaincfg.Params) string {
	netname := chainParams.Name
	switch chainParams.Net {
	case wire.TestNet2:
		netname = "testnet2"
	}
	return filepath.Join(dataDir, netname)
}