![Python_logo_and_wordmark.svg.png](https://files.peakd.com/file/peakd-hive/primersion/23wqEdP3oZmPkLo8xVeU41o1fCWu7gRKCsyNCrsAm5u73bhH4nocYD6AZpwmZjPWk8gxC.png) With all of the recent scams and phishing websites here on HIVE the topic of recovery accounts has come up again. A lot of people still have there recovery account set to @steem or the account, which created their account e.g. @esteemapp or @blocktrades. Setting the recovery account to a HIVE account you trust is really important in case someone is taking over your account. Otherwise all your hardly earned HIVE will be lost and there is no way of recovering it. When choosing a recovery account it is important you choose someone you trust and someone, who can identify you. --- I myself use another account I created as my recovery account. The keys of the account are locked away and not easily accessible by an attacker. But this may not be the best solution for everyone. In particular I have set @recovery.hive as the recovery account for @primersion and @primersion as the recovery account for @recovery.hive. The only way an attacker would be able to steal all of my funds would be to gain access to the keys for both accounts and if this should happen, it is my own fault ;) --- Changing your recovery account is quite easy. You can use tools like the one created by @arcange [over here](https://tools.hivechain.app/recovery/) or the one created by @reazuliqbal you will find [over here](https://reazuliqbal.com/HiveAccountRecovery/) or change it directly on [peakd.com](https://peakd.com) under your Account Settings -> Keys & Permissions. Or you may use this small python script I wrote: ``` #!/usr/bin/python3 from beem import Hive from beem.nodelist import NodeList from beem.account import Account nodelist = NodeList() nodelist.update_nodes() nodes = nodelist.get_hive_nodes() account_name = input("Enter your account name: ") owner_key = input("Enter your private owner key: ") new_recovery_account = input("Enter new recovery account: ") hive = Hive(node=nodes, keys=[owner_key]) account = Account(account_name, blockchain_instance=hive) account.change_recovery_account(new_recovery_account) print("Successfully changed recovery account") ``` You have to enter your account name and private owner key and the new recovery account and the script does the rest for you. Please be careful when using the script and when pasting your private owner key. --- In addition to that I wrote a small script for recovering your account (if you are using another of your accounts as a recovery account for your main account). The script is based on the information provided [here in the official docs](https://developers.hive.io/tutorials-python/account_recovery.html): ``` #!/usr/bin/python3 import beembase from beem.account import Account from beem import Hive from beem.transactionbuilder import TransactionBuilder from beemgraphenebase.account import PasswordKey from beembase.objects import Permission from beem.nodelist import NodeList # acquire hive node list nodelist = NodeList() nodelist.update_nodes() nodes = nodelist.get_hive_nodes() # capture user information username = input('account to be recovered: ') old_password = input('recent password for account: ') new_password = input('new password for account: ') recovery_account = input('account owner (recovery account): ') recovery_account_private_key = input('account owner private ACTIVE key: ') # create new account owner keys new_account_owner_private_key = PasswordKey(username, new_password, role='owner').get_private_key() new_account_owner_private_key_string = str(new_account_owner_private_key) new_account_owner_public_key = str(new_account_owner_private_key.pubkey) # create old account owner keys old_account_owner_private_key = PasswordKey(username, old_password, role='owner').get_private_key() old_account_owner_private_key_string = str(old_account_owner_private_key) old_account_owner_public_key = str(old_account_owner_private_key.pubkey) new_owner_authority = { "key_auths": [ [new_account_owner_public_key, 1] ], "account_auths": [], "weight_threshold": 1 } # recovery request data object creation request_op_data = { 'account_to_recover': username, 'recovery_account': recovery_account, 'new_owner_authority': new_owner_authority, 'extensions': [] } # recovery request operation creation request_op = beembase.operations.Request_account_recovery(**request_op_data) print('request_op_data') print(request_op_data) # recovery request broadcast hive = Hive(node=nodes, keys=[recovery_account_private_key]) request_result = hive.finalizeOp(request_op, recovery_account, "active") print('request_result') print(request_result) recent_owner_authority = { "key_auths": [ [old_account_owner_public_key, 1] ], "account_auths": [], "weight_threshold": 1 } op_recover_account_data = { 'account_to_recover': username, 'new_owner_authority': new_owner_authority, 'recent_owner_authority': recent_owner_authority, 'extensions': [] } op_account_update_data = { "account": username, "active": { "key_auths": [ [str(PasswordKey(username, new_password, role='active').get_private_key().pubkey), 1] ], "account_auths": [], "weight_threshold": 1 }, "posting": { "key_auths": [ [str(PasswordKey(username, new_password, role='posting').get_private_key().pubkey), 1] ], "account_auths": [], "weight_threshold": 1 }, "memo_key": str(PasswordKey(username, new_password, role='memo').get_private_key().pubkey), "json_metadata": "" } op_recover_account = beembase.operations.Recover_account(**op_recover_account_data) print('op_recover_account') print(op_recover_account) tb = TransactionBuilder(blockchain_instance=hive) tb.appendOps([op_recover_account]) tb.appendWif(str(old_account_owner_private_key)) tb.appendWif(str(new_account_owner_private_key)) tb.sign() result = tb.broadcast() print('result') print(result) op_account_update = beembase.operations.Account_update(**op_account_update_data) print('op_account_update') print(op_account_update) hive = Hive(node=nodes, keys=[new_account_owner_private_key]) tb = TransactionBuilder(blockchain_instance=hive) tb.appendOps([op_account_update]) tb.appendWif(str(new_account_owner_private_key)) tb.sign() result = tb.broadcast() print('result') print(result) ``` You will have to enter the account to be recovered, a recent password of the account and a new password for the account. For the actual recovery account you have to enter the account name and the private active key of the account. The remaining stuff like creating the account recovery request, recovering the account and updating the account data will be done by the script. --- ##### Please update your recovery account right now if you still have it set to @steem --- Which account are you using as your recovery account, someone you trust or just some well-known and trustworthy account? --- Like what I am doing - please support me by voting for my [HIVE](https://vote.hive.uno/?witness=primersion) / [Hive-Engine](https://votify.now.sh/primersion) witness.

See: Changing your recovery account and recovering your account using python by @primersion