func CreatePuzzleStore(pair *match.Pair) (store cxdb.PuzzleStore, err error) {
	conf := new(dbsqlConfig)
	*conf = *defaultConf
	dbConfigSetup(conf)
	var addr net.Addr
	if addr, err = net.ResolveTCPAddr("tcp", net.JoinHostPort(conf.DBHost, fmt.Sprintf("%d", conf.DBPort))); err != nil {
		err = fmt.Errorf("Couldn't resolve db address for CreateSQLPuzzleStore: %s", err)
		return
	}
	sp := &SQLPuzzleStore{
		dbUsername:   conf.DBUsername,
		dbPassword:   conf.DBPassword,
		puzzleSchema: conf.PuzzleSchemaName,
		dbAddr:       addr,
		pair:         pair,
	}
	if err = sp.setupPuzzleStoreTables(); err != nil {
		err = fmt.Errorf("Error setting up settlement store tables while creating store: %s", err)
		return
	}
	openString := fmt.Sprintf("%s:%s@%s(%s)/", sp.dbUsername, sp.dbPassword, sp.dbAddr.Network(), sp.dbAddr.String())
	if sp.DBHandler, err = sql.Open("mysql", openString); err != nil {
		err = fmt.Errorf("Error opening database for CreateSQLPuzzleStore: %s", err)
		return
	}
	if err = sp.DBHandler.Ping(); err != nil {
		err = fmt.Errorf("Could not ping the database, is it running: %s", err)
		return
	}
	store = sp
	return
}
CreatePuzzleStore creates a puzzle store for a specific coin.
package cxdbsql
import (
	"database/sql"
	"encoding/hex"
	"fmt"
	"net"
	_ "github.com/go-sql-driver/mysql"
	"github.com/mit-dci/opencx/cxdb"
	"github.com/mit-dci/opencx/match"
)
type SQLPuzzleStore struct {
	DBHandler *sql.DB
	dbUsername string
	dbPassword string
	dbAddr net.Addr
	puzzleSchema string
	pair *match.Pair
}
const (
	puzzleStoreSchema = "encodedOrder TEXT, auctionID VARBINARY(64), selected BOOLEAN"
)