忘记steem账号密码后,用 python 提取 beem 本地钱包里私钥

steem 账号有四个密码:"owner", "active", "posting", "memo".
0.jpg
各司其职,增加了使用安全,但也带来了密码记忆的困难.

正常情况下,用专门的文件保存一份,但文件也有被损坏的时候.

最近就把账号密码搞丢了,怎么办?

后来想想,用这个这个账号研究 steem 的 python编程时,导入过 beem的本地钱包里面,看看能不能提取出来.

想到这儿,立马开干.

获取本地钱包内私钥(get_private_key_from_beempy_wallet.py):

#!/usr/bin/python
# -*- coding: UTF-8 -*-
# python get_private_key_from_beempy_wallet.py
# python get_private_key_from_beempy_wallet.py sample

import sys
import json
from beem import Steem
from beem.instance import shared_steem_instance

# 输入本地钱包密码或在代码中直接赋值
# Enter the local wallet password or set value directly in the code
# password = input('local wallet password : ')
password = "wallet8password"

stm = shared_steem_instance()
stm.wallet.unlock(password)
private_key = {}

try:
    account = sys.argv[1]
except Exception as e:
    account = None

if not account:
    account = input('steem account username: ')

for role in ["owner", "active", "posting", "memo"]:
    try:
        private_key[role] = stm.wallet.getKeyForAccount(account, role)
    except Exception as e:
        print('no', role, ' key in local wallet for', account)

print('private_key:', json.dumps(private_key, indent=4))

执行程序:python get_private_key_from_beempy_wallet.py

Sort:  

This post earned a total payout of 1.334$ and 0.667$ worth of author reward that was liquified using @likwid.
Learn more.

This post earned a total payout of 0.054$ and 0.027$ worth of author reward that was liquified using @likwid.
Learn more.

Congratulations @anonymity.inlet! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You published more than 10 posts. Your next target is to reach 20 posts.
You distributed more than 500 upvotes. Your next target is to reach 600 upvotes.
You received more than 500 upvotes. Your next target is to reach 1000 upvotes.

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

This post has no sub-beneficiaries

This post earned a total payout of 0.044$ and 0.022$ worth of author reward that was liquified using @likwid.
Learn more.

This post has no sub-beneficiaries

This post earned a total payout of 0.000$ and 0$ worth of author reward that was liquified using @likwid.
Learn more.

Coin Marketplace

STEEM 0.22
TRX 0.20
JST 0.034
BTC 98713.95
ETH 3352.77
USDT 1.00
SBD 3.07