steems.top 更新,添加高级授权工具

in hive-180932 •  3 months ago  (edited)

工具网址:https://steemw.herokuapp.com

更新:添加高级授权工具,可授权active和owner权限。

目前的steem上的所有工具几乎没有可授权active和owner权限,所以写了一个给部分有需要的人。请注意这是高危操作,不要乱授权。

image.png

image.png

image.png

输入你的owner key,然后选择授权的权限与用户名,点击添加授权即可。

image.png

授权完毕可以上区块浏览器看看是否成功

核心源代码

def remove_authorization(types,player,delplayer,key,nodes):
    s = Steem(keys=[key], node=nodes)
    account = Account(player, steem_instance=s)
    who =account[types]
    who["account_auths"].remove([delplayer, 1])
    print(who)

    op = operations.Account_update(
        **{
            "account": account["name"],
            "json_metadata": account["json_metadata"],
            types: who,
            "memo_key": account["memo_key"]
        })
    tx = TransactionBuilder(steem_instance=s)

    tx.appendOps(op)
    # 把签名添加并签名
    if types == "posting":
        tx.appendSigner(player, "active")
    else:
        tx.appendSigner(player, "owner")
    tx.sign()

    # 生成transaction_id
    signn = {'expiration': tx['expiration'], 'ref_block_num': tx['ref_block_num'],
             'ref_block_prefix': tx['ref_block_prefix'], 'operations': tx['operations'], 'extensions': []}
    kk = copy.deepcopy(signn)
    # print("测试",kk)
    txx = Signed_Transaction(kk)
    txx.data.pop("signatures", None)
    h = hashlib.sha256(bytes(txx)).digest()
    transaction_id = hexlify(h[:20]).decode("ascii")
    # print(transaction_id)
    url = "https://steemd.com/tx/%s" % transaction_id
    print(url)
    #广播
    tx.broadcast()
    return url


def authorization(types,player,addplayer,key,nodes):
    s = Steem(keys=[key], node=nodes)
    account = Account(player, steem_instance=s)
    who =account[types]
    who["account_auths"].append([addplayer, 1])
    print(who)
    op = operations.Account_update(
        **{
            "account": account["name"],
            "json_metadata": account["json_metadata"],
            types: who,
            "memo_key": account["memo_key"]
        })
    tx = TransactionBuilder(steem_instance=s)

    tx.appendOps(op)
    # 把签名添加并签名
    if types == "posting":
        tx.appendSigner(player, "active")
    else:
        tx.appendSigner(player, "owner")
    tx.sign()

    # 生成transaction_id
    signn = {'expiration': tx['expiration'], 'ref_block_num': tx['ref_block_num'],
             'ref_block_prefix': tx['ref_block_prefix'], 'operations': tx['operations'], 'extensions': []}
    kk = copy.deepcopy(signn)
    # print("测试",kk)
    txx = Signed_Transaction(kk)
    txx.data.pop("signatures", None)
    h = hashlib.sha256(bytes(txx)).digest()
    transaction_id = hexlify(h[:20]).decode("ascii")
    # print(transaction_id)
    url = "https://steemd.com/tx/%s" % transaction_id
    print(url)
    #广播
    tx.broadcast()
    return url
Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

!tickets

Your tickets:[0, 1, 2, 3, 4, 5, 6, 7, 8],season:1,open_block:53353400

!season1

season1,winners:{24, 9, 22, 6}

@maiyude 鱼哥, may i know if you plan to add the follow system tool anytime soon ?

  1. Or is it possible for you to share the code and steps to setup it up on herokuapp ?

Hi @maiyude

xpilar.witness
I want to contribute even more and I now want to announce that @xpilar.witness is mine and that I am running this witness

I see that I have voted for you and will ask you the same thing