Example #1
0
def main(ctx, password, broadcast, parent_account, account_name):
    """Use this script to create new account.

    By default, a random password will be generated. By default, transaction will not be broadcasted (dry-run mode).
    """
    account = Account(parent_account, bitshares_instance=ctx.bitshares)

    # random password
    if not password:
        password = generate_password()

    print('password: {}\n'.format(password))
    # prints keys to stdout
    get_keys_from_password(account_name, password, ctx.bitshares.prefix)

    if not broadcast:
        ctx.log.info('Not broadcasting!')
        sys.exit(0)

    try:
        ctx.bitshares.create_account(
            account_name,
            registrar=parent_account,
            referrer=account['id'],
            referrer_percent=0,
            password=password,
            storekeys=True,
        )
    except MissingKeyError:
        ctx.log.critical(
            'No key for {} in storage, use `uptick addkey` to add'.format(
                parent_account))
        sys.exit(1)
def main(ctx, broadcast, password, account_name):
    """
    Change account keys derived from password.

    By default, random password is geneeated
    """

    if not password:
        password = generate_password()

    print('password: {}\n'.format(password))

    prefix = ctx.helper.steemd.chain_params["prefix"]
    keys = get_keys_from_password(account_name,
                                  password,
                                  prefix,
                                  key_types=key_types)

    # prepare for json format
    owner_key_authority = [(keys['owner'], 1)]
    active_key_authority = [(keys['active'], 1)]
    posting_key_authority = [(keys['posting'], 1)]
    owner_accounts_authority: List[Tuple[str, int]] = []
    active_accounts_authority: List[Tuple[str, int]] = []
    posting_accounts_authority: List[Tuple[str, int]] = []

    pre_op = {
        'account': account_name,
        'memo_key': keys['memo'],
        'owner': {
            'account_auths': owner_accounts_authority,
            'key_auths': owner_key_authority,
            'weight_threshold': 1
        },
        'active': {
            'account_auths': active_accounts_authority,
            'key_auths': active_key_authority,
            'weight_threshold': 1,
        },
        'posting': {
            'account_auths': posting_accounts_authority,
            'key_auths': posting_key_authority,
            'weight_threshold': 1,
        },
        'prefix': prefix,
    }

    op = AccountUpdate(**pre_op)
    ctx.log.debug(pformat(op.json()))

    if not broadcast:
        ctx.log.info('Not broadcasting!')
        sys.exit(0)

    ctx.helper.finalizeOp(op, account_name, "owner")
Example #3
0
def main(ctx, broadcast, password, creator, account):
    """
    Create new account.

    CREATOR is parent account who will create child account

    ACCOUNT is new account name
    """

    if not password:
        password = generate_password()

    print('password: {}\n'.format(password))
    # prints keys to stdout
    prefix = ctx.helper.steemd.chain_params["prefix"]
    get_keys_from_password(account, password, prefix, key_types=key_types)

    if not broadcast:
        ctx.log.info('Not broadcasting!')
        sys.exit(0)

    ctx.helper.create_account(account, creator=creator, password=password)
def main(ctx, password, broadcast, account_name):
    """Use this script to change account keys.

    By default, a random will be generated. By default, transaction will not be broadcasted (dry-run mode).
    """
    account = Account(account_name, bitshares_instance=ctx.bitshares)

    # random password
    if not password:
        password = generate_password()

    print('password: {}\n'.format(password))

    key = get_keys_from_password(account_name, password, ctx.bitshares.prefix)

    # prepare for json format
    account['options']['memo_key'] = key['memo']
    owner_key_authority = [(key['owner'], 1)]
    active_key_authority = [(key['active'], 1)]
    owner_accounts_authority: List[Tuple[str, int]] = []
    active_accounts_authority: List[Tuple[str, int]] = []

    pre_op = {
        'account': account['id'],
        'new_options': account['options'],
        'owner': {'account_auths': owner_accounts_authority, 'key_auths': owner_key_authority, 'weight_threshold': 1},
        'active': {
            'account_auths': active_accounts_authority,
            'key_auths': active_key_authority,
            'weight_threshold': 1,
        },
        'fee': {'amount': 0, 'asset_id': '1.3.0'},
        'extensions': {},
        'prefix': ctx.bitshares.prefix,
    }

    op = operations.Account_update(**pre_op)
    ctx.log.debug(pformat(op.json()))

    if not broadcast:
        ctx.log.info('Not broadcasting!')
        sys.exit(0)

    try:
        ctx.bitshares.finalizeOp(op, account_name, 'owner')
    except MissingKeyError:
        ctx.log.critical('No key for {} in storage, use `uptick addkey` to add'.format(account_name))
        sys.exit(1)
Example #5
0
def main(ctx, account_name, password):
    """Generate private keys from password."""

    get_keys_from_password(account_name, password, ctx.bitshares.prefix)