func New(coin string) (*Bitcoind, error) {
	var (
		username, _ = gocore.Config().Get(coin + "_user")
		password, _ = gocore.Config().Get(coin + "_password")
		host, _     = gocore.Config().Get(coin + "_host")
		port, _     = gocore.Config().GetInt(coin + "_port")
		useSSL      = false
		zmqPort, _  = gocore.Config().GetInt(coin + "_zmqPort")

		dbHost, _     = gocore.Config().Get("db_host")
		dbPort, _     = gocore.Config().GetInt("db_port")
		dbName, _     = gocore.Config().Get("db_name")
		dbUser, _     = gocore.Config().Get("db_user")
		dbPassword, _ = gocore.Config().Get("db_password")
	)

	rpcClient, err := newClient(host, port, username, password, useSSL)
	if err != nil {
		return nil, err
	}

	dbinfo := fmt.Sprintf("user=%s password=%s dbname=%s sslmode=disable host=%s port=%d", dbUser, dbPassword, dbName, dbHost, dbPort)
	db, err := sql.Open("postgres", dbinfo)
	if err != nil {
		return nil, err
	}

	bitcoind := &Bitcoind{
		coin:   coin,
		client: rpcClient,
		db:     db,
	}

	if zmqPort != 0 {
		zmqAddress := fmt.Sprintf("tcp://%s:%d", host, zmqPort)
		bitcoind.connectToZMQ(zmqAddress)
	}

	return bitcoind, nil
}
// New return a new bitcoind
New return a new bitcoind
// New return a new bitcoind
func New(coin string) (*Bitcoind, error) {
	var (
		username, _ = gocore.Config().Get(coin + "_user")
		password, _ = gocore.Config().Get(coin + "_password")
		host, _     = gocore.Config().Get(coin + "_host")
		port, _     = gocore.Config().GetInt(coin + "_port")
		useSSL      = false
		zmqPort, _  = gocore.Config().GetInt(coin + "_zmqPort")
		dbHost, _     = gocore.Config().Get("db_host")
		dbPort, _     = gocore.Config().GetInt("db_port")
		dbName, _     = gocore.Config().Get("db_name")
		dbUser, _     = gocore.Config().Get("db_user")
		dbPassword, _ = gocore.Config().Get("db_password")
	)
	rpcClient, err := newClient(host, port, username, password, useSSL)
	if err != nil {
		return nil, err
	}
	dbinfo := fmt.Sprintf("user=%s password=%s dbname=%s sslmode=disable host=%s port=%d", dbUser, dbPassword, dbName, dbHost, dbPort)
	db, err := sql.Open("postgres", dbinfo)
	if err != nil {
		return nil, err
	}
	bitcoind := &Bitcoind{
		coin:   coin,
		client: rpcClient,
		db:     db,
	}
	if zmqPort != 0 {
		zmqAddress := fmt.Sprintf("tcp://%s:%d", host, zmqPort)
		bitcoind.connectToZMQ(zmqAddress)
	}
	return bitcoind, nil
}
func New ( coin string ) ( * Bitcoind , error ) { var ( username , _ = gocore . Config ( ) . Get ( coin + " " ) password , _ = gocore . Config ( ) . Get ( coin + " " ) host , _ = gocore . Config ( ) . Get ( coin + " " ) port , _ = gocore . Config ( ) . GetInt ( coin + " " ) useSSL = false zmqPort , _ = gocore . Config ( ) . GetInt ( coin + " " ) dbHost , _ = gocore . Config ( ) . Get ( " " ) dbPort , _ = gocore . Config ( ) . GetInt ( " " ) dbName , _ = gocore . Config ( ) . Get ( " " ) dbUser , _ = gocore . Config ( ) . Get ( " " ) dbPassword , _ = gocore . Config ( ) . Get ( " " ) ) rpcClient , err := newClient ( host , port , username , password , useSSL ) if err != nil { return nil , err } dbinfo := fmt . Sprintf ( " " , dbUser , dbPassword , dbName , dbHost , dbPort ) db , err := sql . Open ( " " , dbinfo ) if err != nil { return nil , err } bitcoind := & Bitcoind { coin : coin , client : rpcClient , db : db , } if zmqPort != 0 { zmqAddress := fmt . Sprintf ( " " , host , zmqPort ) bitcoind . connectToZMQ ( zmqAddress ) } return bitcoind , nil }
New return a new bitcoind
New return a new bitcoind