Пример #1
0
func main() {
	initLogging(logging.DEBUG, true)
	cfg := initConfig()
	initProfiling(cfg.HttpProf)

	// print pubkey so that client can use that to communicate with server
	sk := cipher.MustSecKeyFromHex(cfg.Seckey)
	logger.Info("pubkey:%v", cipher.PubKeyFromSecKey(sk).Hex())

	s := server.New(cfg)
	// Bind supported coins
	s.BindCoins(
		&bitcoin.Bitcoin{},
		skycoin.New(cfg.NodeAddresses[skycoin.Type]),
		mzcoin.New(cfg.NodeAddresses[mzcoin.Type]))
	s.Run()
}
Пример #2
0
func main() {
	var cfg client.Config
	home := util.UserHome()

	var servPubkey string
	flag.StringVar(&cfg.ServAddr, "s", "localhost:8080", "server address")
	flag.IntVar(&cfg.Port, "p", 6060, "rpc port")
	flag.StringVar(&cfg.GuiDir, "gui-dir", "./src/web-app/static", "webapp static dir")
	flag.StringVar(&cfg.WalletDir, "wlt-dir", filepath.Join(home, ".exchange-client/wallet"), "wallet dir")
	flag.StringVar(&cfg.AccountDir, "account-dir", filepath.Join(home, ".exchange-client/account"), "account dir")
	flag.StringVar(&servPubkey, "server-pubkey", "02942e46684114b35fe15218dfdc6e0d74af0446a397b8fcbf8b46fb389f756eb8", "server pubkey")

	flag.Parse()

	cfg.GuiDir = util.ResolveResourceDirectory(cfg.GuiDir)

	// init sknet server pubkey
	sknet.SetPubkey(servPubkey)

	// init logger.
	initLogging(logging.DEBUG, true)

	quit := make(chan int)
	go catchInterrupt(quit)

	// Watch for SIGUSR1
	go catchDebug()

	c := client.New(cfg)
	c.BindCoins(&bitcoin.Bitcoin{},
		skycoin.New(cfg.ServAddr),
		mzcoin.New(cfg.ServAddr))
	c.Run()

	<-quit

	logger.Info("Goodbye")
}