通过程序自动获得Hive免费账号


前几天写了一篇文章总结了如何使用第三方工具获得免费账号。但作为一个懒人,肯定还是想要通过程序自动实现的好。下面介绍一个完整的步骤。

image.png

首先说一说前提条件。你的账户需要足够的HP才可以,我现在有5000多的HP,满血时只能获得两个免费账号。同时需要事先安装好Beem

程序的基本思路就是根据目前Resource Credits的百分比来决定是否要领取免费账号(Claim account)。比如:可以设置为如果RC >= 80%,就进行领取。

至于目前RC百分比的判断,可以采用如下的代码:

from beem.account import Account
creator = Account('aafeng')
current_rc = float(creator.get_rc()['rc_manabar']['current_mana'])
max_rc = float(creator.get_rc()['max_rc'])
print(100 * current_rc / max_rc)

其输出结果为:

76.26412538197629

这个数字就是目前RC的百分比。接下来需要定义一个RC_THRESHOLD,再用上面的百分比和RC_THRESHOLD进行比较,从而决定是否要Claim account。使用Beem claim account的代码片段如下:

RC_THRESHOLD = 75
hive = Steem(node="https://anyx.io", keys=[active_key])
if 100* current_rc / max_rc > RC_THRESHOLD:
    hive.claim_account(‘aafeng’)

把上面的代码放在一起:

from sys import argv
from beem import Steem
from beem.account import Account

RC_THRESHOLD = 75

if __name__ == "__main__":
    user       = argv[1]
    active_key = argv[2]
    hive = Steem(node="https://anyx.io", keys=[active_key])                                                                            
    creator = Account(user)
    current_rc = float(creator.get_rc()['rc_manabar']['current_mana'])
    max_rc = float(creator.get_rc()['max_rc'])
    if 100* current_rc / max_rc > RC_THRESHOLD:
        hive.claim_account(creator)                                                                                                      
        print("Claimed an account")
    else:
        print("Below RC threshold")

运行这个程序:

python autoca.py aafeng YOUR_ACTIVE_KEY

已经成功的Claim了一个账号。再把这个程序加入Cron job,就可以完全不用管它了。。。

当然,对于HP值很大的账号来说,可以在程序中多次Claim账号,这就需要把上面的程序稍作修改,每次Claim完之后再检测一下当前的RC百分比,然后再次进行判断来决定是否继续Claim。这里需要注意每次Claim账号之后,需要在程序中停顿几秒,等待节点信息更新后,否则可能获取不到最新的RC百分比。


Comments 13


HIVE (THE NON-COMMUNIST, NON-CENSORED, JUSTIN SUN EXCLUDING SOCIAL BLOCKCHAIN) IS ALIVE, COME JOIN US!!!

https://peakd.com <--- Log in with your Steem account today!!

04.04.2020 11:43
0

5 连👏

04.04.2020 23:18
0

谢谢

05.04.2020 09:13
0

HIVE (THE NON-COMMUNIST, NON-CENSORED, JUSTIN SUN EXCLUDING SOCIAL BLOCKCHAIN) IS ALIVE, COME JOIN US!!!

https://peakd.com <--- Log in with your Steem account today!!



































06.04.2020 14:35
0

HIVE (THE NON-COMMUNIST, NON-CENSORED, JUSTIN SUN EXCLUDING SOCIAL BLOCKCHAIN) IS ALIVE, COME JOIN US!!!

https://peakd.com <--- Log in with your Steem account today!!



































06.04.2020 14:35
0

HIVE (THE NON-COMMUNIST, NON-CENSORED, JUSTIN SUN EXCLUDING SOCIAL BLOCKCHAIN) IS ALIVE, COME JOIN US!!!

https://peakd.com <--- Log in with your Steem account today!!



































06.04.2020 14:35
0

HIVE (THE NON-COMMUNIST, NON-CENSORED, JUSTIN SUN EXCLUDING SOCIAL BLOCKCHAIN) IS ALIVE, COME JOIN US!!!

https://peakd.com <--- Log in with your Steem account today!!



































06.04.2020 14:35
0

HIVE (THE NON-COMMUNIST, NON-CENSORED, JUSTIN SUN EXCLUDING SOCIAL BLOCKCHAIN) IS ALIVE, COME JOIN US!!!

https://peakd.com <--- Log in with your Steem account today!!



































06.04.2020 14:35
0

HIVE (THE NON-COMMUNIST, NON-CENSORED, JUSTIN SUN EXCLUDING SOCIAL BLOCKCHAIN) IS ALIVE, COME JOIN US!!!

https://peakd.com <--- Log in with your Steem account today!!



































06.04.2020 14:35
0

正好需要,谢谢

05.04.2020 11:12
0

不用客气

05.04.2020 11:17
0

剛好想要新號,謝了

05.04.2020 14:04
0

好 SHARE 啪啪啪

09.04.2020 19:21
0