def getcred(username, wif): key_auths_public = {} key_auths_private = {} for role in ['owner', 'active', 'posting', 'memo']: pk = PasswordKey(username, wif, role=role, prefix="EUR") key_auths_public[role] = str(pk.get_public_key()) key_auths_private[role] = str(pk.get_private_key()) data = { "name": username, "wif": wif, "owner": [{ "type": "public", "value": key_auths_public["owner"] }, { "type": "private", "value": key_auths_private["owner"] }], "active": [{ "type": "public", "value": key_auths_public["active"] }, { "type": "private", "value": key_auths_private["active"] }], "posting": [{ "type": "public", "value": key_auths_public["posting"] }, { "type": "private", "value": key_auths_private["posting"] }], "memo": [{ "type": "public", "value": key_auths_public["memo"] }, { "type": "private", "value": key_auths_private["memo"] }] } print(json.dumps(data, indent=4))
stm = Steem(node=testnet_node) prefix = stm.prefix # curl --data "username=username&password=secretPassword" https://testnet.steem.vc/create if useWallet: stm.wallet.wipe(True) stm.wallet.create(walletpassword) stm.wallet.unlock(walletpassword) active_key = PasswordKey(username, password, role="active", prefix=prefix) owner_key = PasswordKey(username, password, role="owner", prefix=prefix) posting_key = PasswordKey(username, password, role="posting", prefix=prefix) memo_key = PasswordKey(username, password, role="memo", prefix=prefix) active_pubkey = active_key.get_public_key() owner_pubkey = owner_key.get_public_key() posting_pubkey = posting_key.get_public_key() memo_pubkey = memo_key.get_public_key() active_privkey = active_key.get_private_key() posting_privkey = posting_key.get_private_key() owner_privkey = owner_key.get_private_key() memo_privkey = memo_key.get_private_key() if useWallet: stm.wallet.addPrivateKey(owner_privkey) stm.wallet.addPrivateKey(active_privkey) stm.wallet.addPrivateKey(memo_privkey) stm.wallet.addPrivateKey(posting_privkey) else: stm = Steem(node=testnet_node, wif={'active': str(active_privkey), 'posting': str(posting_privkey), 'memo': str(memo_privkey)}) account = Account(username, steem_instance=stm) if account["name"] == "beem":
except Exception as exception: assert type(exception).__name__ == 'AccountDoesNotExistsException' assert exception.__class__.__name__ == 'AccountDoesNotExistsException' sys.exit( "The account provided doesn't exist in the EFTG Blockchain. Wrong account " + args.account[0]) password = args.password[0] key_auths_public = {} key_auths_private = {} blk_auths_public = {} for role in ['owner', 'active', 'posting', 'memo']: pk = PasswordKey(account['name'], password, role=role, prefix=prefix) key_auths_public[role] = str(pk.get_public_key()) key_auths_private[role] = str(pk.get_private_key()) if role == "memo": blk_auths_public[role] = str(account.json()["memo_key"]) else: blk_auths_public[role] = str(account.json()[role]["key_auths"][0][0]) if key_auths_public[role] != blk_auths_public[role]: sys.exit("Password provided is not correct. Public " + role + " key " + key_auths_public[role] + " doesn't match the one in the EFTG blockchain " + blk_auths_public[role]) data = { "name": account['name'], "wif":
(acc['name'])) if not checkwif(acc['name'], cur_password): sys.exit("Password provided is not correct.") new_password = unix_getpass(prompt='New password for @%s: ' % (acc['name'])) repeat_pwd = unix_getpass(prompt='Repeat new password for @%s: ' % (acc['name'])) assert (new_password == repeat_pwd) signing_key = PasswordKey(acc['name'], cur_password, role="owner", prefix=prefix) wif = str(signing_key.get_private_key()) #Since we're going to build a transaction is simpler to do everything here instead of using a function key_auths_public = {} key_auths_private = {} for role in ['owner', 'active', 'posting', 'memo']: pk = PasswordKey(acc['name'], new_password, role=role, prefix="EUR") key_auths_public[role] = str(pk.get_public_key()) key_auths_private[role] = str(pk.get_private_key()) op = operations.Account_update( **{ "account": acc["name"], 'owner': { 'account_auths': [], 'key_auths': [[key_auths_public['owner'], 1]],