def create(btctxstore, path, password=None):
    hwif = btctxstore.create_wallet()
    wif = btctxstore.get_key(hwif)
    address = btctxstore.get_address(wif)
    config = {
        "version": __version__,
        "wallet": hwif,
        "payout_address": address,  # default to wallet address
    }
    return save(btctxstore, path, config, password=password)
def validate(btctxstore, config):

    # is a dict
    if not isinstance(config, dict):
        raise exceptions.InvalidConfig()

    # correct version
    if config.get("version") != __version__:
        raise exceptions.InvalidConfig()

    # has valid payout address
    if not btctxstore.validate_address(config.get("payout_address")):
        raise exceptions.InvalidConfig()

    # has valid wallet
    wif = btctxstore.get_key(config.get("wallet"))
    if not btctxstore.validate_key(wif):
        raise exceptions.InvalidConfig()