Claiming and creating a discounted account using beem

in #beem6 years ago (edited)

This post is about claiming and creating a discounted account using beem. We will create two python scripts, one for claiming and the other one for creating. The RC costs for claiming a new account are 4978.034244114 G RC (https://beempy.com/resource_costs).

Claiming a discounted account

Store the following lines as claim_account.py

#!/usr/bin/python
from beem import Steem
from beem.account import Account
from beem.rc import RC
import getpass
import time


if __name__ == "__main__":
    wif = getpass.getpass(prompt='Enter your active key:')
    stm = Steem(node="https://api.steemit.com", keys=[wif])
    creator = stm.wallet.getAccountFromPrivateKey(wif)
    creator = Account(creator)
    rc = RC(steem_instance=stm)
    current_costs = stm.get_rc_cost(rc.get_resource_count(tx_size=250, new_account_op_count=1))
    current_mana = creator.get_rc_manabar()["current_mana"]
    last_mana = current_mana
    print("Current costs %.2f G RC - current mana %.2f G RC" % (current_costs / 1e9, current_mana / 1e9))
    if current_costs + 10 < current_mana:
        stm.claim_account(creator)
        time.sleep(10)
        creator.refresh()
        current_mana = creator.get_rc_manabar()["current_mana"]
        print("Account claimed and %.2f G RC paid." % ((last_mana - current_mana) / 1e9))
        last_mana = current_mana
    else:
        print("Not enough RC for a claim!")

Be sure to have beem installed (pip install -U beem). After storing the file,
it can be started by

python claim_account.py

The script is then asking for the active key of the claimer. The account name is automatically determined by the getAccountFromPrivateKey function. The script calculates the RC costs and checks if the operation will be sucessfull. If enougth RCs are available, one discounted account is claimed.

Enter your active key.
Current costs 4982.55 G RC - current mana 7890.16 G RC
Account claimed and 4966.93 G RC paid.

Creating a discounted account

Store the following lines as create_claimed_account.py

#!/usr/bin/python
from beem import Steem
from beem.account import Account
from beem.rc import RC
import getpass
import argparse
import time


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description='Creating a claimed account.')
    parser.add_argument('new_account_name', type=str, 
                       help='Account name from the account that should be created.')
    args = parser.parse_args()
    if args.new_account_name is None:
        raise ValueError("Please enter a name.")
        
    wif = getpass.getpass(prompt='Enter the active key of the account creator:')
    password = getpass.getpass(prompt='Enter the new password for the new account:')
    password2 = getpass.getpass(prompt='Re-Enter the new password for the new account:')
    if password != password2:
        raise ValueError("Password do not match!")
    stm = Steem(node="https://api.steemit.com", keys=[wif])
    creator = stm.wallet.getAccountFromPrivateKey(wif)
    creator = Account(creator)
    print(stm.create_claimed_account(args.new_account_name, creator=creator, password=password))
    time.sleep(10)
    
    new_account = Account(args.new_account_name)
    new_account.print_info()

After storing the file, it can be started by:

python create_claimed_account.py new_account_name

I will create a new account named beempy by entering:

python create_claimed_account.py beempy

After pressing return, the script asks for the active key of the creator and twice for the new account password:

Enter the active key of the account creator:
Enter the new password for the new account:
Re-Enter the new password for the new account:
{'expiration': '2018-10-05T10:43:16', 'ref_block_num': 62697, 'ref_block_prefix': 3046425873, 'operations': [['create_claimed_account', {'creator': 'holger80', 'new_account_name': 'beempy', 'owner': {'weight_threshold': 1, 'account_auths': [], 'key_auths': [['STM7c89UajhzdFv5pw9wsXmziSgUpvvBJSGopfmyjApH7vihyMayT', '1']]}, 'active': {'weight_threshold': 1, 'account_auths': [], 'key_auths': [['STM7peepDhHWyzzKW9CjadhTUxSnKETnsEAfPZXw6ogBbt4HTZZif', '1']]}, 'posting': {'weight_threshold': 1, 'account_auths': [], 'key_auths': [['STM8k5brzwzp8QZHJd1mT28Rsky2yMW9zy1oWbozfKzpVUQPfV6Ni', '1']]}, 'memo_key': 'STM6sRudsxWpTZWxnpRkCDVD51RteiJnvJYCt5LiZAbVLfM1hJCQC', 'json_metadata': '', 'extensions': []}]], 'extensions': [], 'signatures': ['1f51ed1ee7a19a8997ee3cf1be090e61075b3e76dcd81e24daee7ec49e878dc1ff580ee65ed10d8b9048fe72235f7939a5fc9598fe0b64929bdde7cc08aa51397b']}
beempy (25.00)
--- Voting Power ---
0.00 %,  VP = 0.00 $
full in 119:59:52
--- Balance ---
0.00 SP, 0.000 STEEM, 0.000 SBD
--- RC manabar ---
Remaining: 100.00 % (6 G RC of 6 G RC)
full in 0:00:00
--- Approx Costs ---
comment - 1.50 G RC - enough RC for 4 comments
vote - 0.31 G RC - enough RC for 19 votes
transfer - 0.12 G RC - enough RC for 50 transfers
custom_json - 0.18 G RC - enough RC for 33 custom_json

The new account beempy was sucessfully created:
image.png


Be sure to store the given account password, it cannot be restored.

Sort:  

I've got an interesting plan to put all these new accounts to use - onboarding the users that have been censored on Facebook recently...

https://steemit.com/freedom/@ura-soul/google-and-facebook-censor-millions-for-political-dissent-let-s-bring-these-folks-to-steem-will-you-help

Vielen Dank, die Accounterstellung funktioniert auch für Leihen problemlos.

Bildschirmfoto_2018-10-06_02-09-59.png

Leider sieht bei mir die Ausgabe im Terminal nicht so Schick aus.
https://pastebin.com/YbezC5vD

und ich habe festgestellt das Umlaute und Sonderzeichen im Passwort nicht akzeptiert werden (UnicodeDecodeError). Das liegt, so nehme ich an, an Steemit allgemein.

Aber nix desto Trotz ein tolles Werkzeug und wie ich schon sagte, sehr einfach zu bedienen.

Vielen Dank für das pastebin, der Fehler (eine Python 2.7 Sache) wird in der nächsten Version behoben sein. Das mit dem UnicodeDecodeError schaue ich mir auch an.

Traceback (most recent call last):
File "create_claimed_account.py", line 2, in module
from beem import Steem
ImportError: No module named beem

You need beem
pip install beem

Posted using Partiko Android

This post has been just added as new item to timeline of beem on Steem Projects.

If you want to be notified about new updates from this project, register on Steem Projects and add beem to your favorite projects.

awesome, thanks for sharing!

Hands down the Steemit community has badass programmers! I salute.
I need to go back and read more so that i up my coding skills.

do you know why the amount of sp to claim an account rose so much was around 50bil RC a week ago and now is 5 trillion

there are less accounts being created now than before the fork so i dont see how this is scaling to quadrillions of accounts like steemit inc claims

Possibly the guys who already predict its future value, took a piece from the pool with creating thousands of them. That's the scalability we are looking for.

I'm able to create half an account, want to share the rest? :)

It is necessary to create an auction of accounts where anyone can sell and buy, perhaps this will help.

yes with hf20 changes buying accounts is a necessity,
seems to me is just another way to extract wealth without brining value,
also it is quite "hopeful" to think more would join to buy accounts and steem power to post frequently when most users dont stay when it was free

Hi @holger80!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your UA account score is currently 6.862 which ranks you at #92 across all Steem accounts.
Your rank has improved 28 places in the last three days (old rank 120).

In our last Algorithmic Curation Round, consisting of 207 contributions, your post is ranked at #6.

Evaluation of your UA score:
  • You've built up a nice network.
  • The readers appreciate your great work!
  • Good user engagement!

Feel free to join our @steem-ua Discord server

Thanks - Resteemed!

Hi!

Congratulations for this amazing "upgrade" of steempy. It has been very helpfull for me.

Please, I have created an account using this tutorial today, but have problems.

Look my steps:

  1. beempy keygen

  2. python (this script here)

  3. when ask for new account password, I have pasted the private key generated by beempy keygen (maybe it was the error)

  4. When I use beempy importaccounts and put this generated privatekey, it imports "active key and posting key" but the account created not showing when type beempy listaccounts

  5. I can add / remove active and posting keys without problems, but when I try to add an owner, it says I have no access

    beem.exceptions.MissingKeyError

  6. Now, what can I do to have full access to this account?

ty vm