获取共同操作账户某个操作的真实操作者,附简单脚本 / Get real operator of a transaction made by the ID which operated by multi accounts, script attached

in #cn7 years ago

我在之前一系列文章中讲过多人如何共同操作一个(公共)账户,以及如何获取共同操作账户所做操作的真实操作者等。

但是很多朋友可能依旧是一头雾水,这里我来总结一下,并附上简单的脚本:

获取共同操作账户的操作者列表 / Obtain the operator list

首先,所谓共同操作账户,亦即一个账户有多个操作者:
@laodr 为例:

茶馆的几位茶东,分别是 @lemoojiang @ace108 @oflyhigh @deanliu @rivalhw (排名不分先后)
所以可以知道这六组公钥分别是五位茶东加laodr 本身。
分别对比六组公钥以及五位茶东的公钥,即可得知操作这列表

如果一个公共账户有多个操作者,但是操作者并未公开,这时候想知道操作者列表略有难度,基本思路是对比,但是几万个账户如何逐一对比?这时候可以考虑把账户数据整个拉下来,本地比较,或者使用数据库服务,比如steemdata, 这些属于另外的话题,暂不做深入探讨了。

获取共同操作账户的某项操作信息 / Obtain information of a transaction

或者共同操作账户的某项操作信息很简单,使用steem查看对应账户即可,当然也可以用API: get_account_history取出一定数量的操作,然后找到需要的内容。

简单来讲,为了获取真实操作者,我们需要两项信息:

  • block_num
  • transaction_id
    比如以下操作:
    20170704100617.png

block_num 为:13362801
transaction_id 为: fca06cc1cb09a93c2edf57d30bbf1583a59b1f26

脚本 / The script

以下为获取共同操作账户某个操作的真实操作者的简单脚本
使用官网的python库

其中通过Signed Transaction 计算出对应公钥部分应该有简洁的方式,但是我试了一下不工作,可能我调用方式有误,感兴趣的读者可以自己试试。

公钥列表部分请按上述描述方法,以及你要查询的共同操作账户自行补充。

#!/usr/bin/env python

import sys
from pprint import pprint
from steem import Steem
from steembase import transactions
from steembase.account import PublicKey
steem_node='https://steemd.steemit.com'

pk_dict = {
'STM8Jee8GQJTNyeonvrd5xcKhNNDbCWbgWB5JuBs4wpxZEfXXXXXX':'user1',
'STM5tT6fKtodfdMGxtcgsQuEYypmMwuLCVaZdsQ7HcbSKCXXXXXXX':'user2',
'STM4wU99xY8zty7LsJFABsPw54iMMxtkndXvr4AAmJufpkLXXXXXX':'user3',
'STM84UFE7DCn8fjMgLw5t2aKBRvQW1qxcwBVWYbek6knJSbCXXXXX':'user4',
'STM8Jee8GQJTNyeonvrd5xcCWbgWB5JuBs4wpxZEfB3KDzXXXXXXX':'user5'
}

help_msg = '''Usage: {} block_num txid 
    Example: {} '''

def get_real_operator(steem, block_num, tx_id):

    block = steem.get_block(block_num)
    index = block['transaction_ids'].index(tx_id)
    tx =  block['transactions'][index]
    
    real_operator = 'Unknown'
    tx_obj = transactions.SignedTransaction(**tx)
    
    for pk_str in pk_dict.keys():
        pk = PublicKey(pk_str)
        pks = [pk]
        try:
            tx_obj.verify(pks, "STEEM")
        except:
            continue
        
        real_operator = pk_dict[pk_str]
        break

    return real_operator, tx

def main(argv=None):

    if len(sys.argv) != 3:
        print(help_msg.format(sys.argv[0], sys.argv[0]))
        print(sys.argv)
        exit()

    block_num = int(sys.argv[1])
    tx_id = sys.argv[2]

    print('-------------------------------------------------------')
    steem = Steem(node=steem_node)

    real_operator, tx = get_real_operator(steem, block_num, tx_id)
    pprint(tx)
    print(f"The real operator of above tx: {real_operator}")
    print('Done!')
    
# ****************************
# main function
# ****************************

if __name__ == "__main__":
        sys.exit(main())

结论 / Conclusion

  • STEEMIT 可以多人操作同一个账户
    The steemit ID can be operated by multi accounts
  • 通过对比公钥的方式可以获得操作者列表(名单及对应公钥)
    We can obtain the operator list by compare the public keys
  • 通过steemd或者get_account_history可以获取block number 以及 transaction id
    We can get block number & transaction id from a transaction by steemd or API
  • 通过block number 以及 transaction id 可以获取Signed Transaction
    Get Signed Transaction from block
  • 通过Signed Transaction 与公钥列表可以判断出哪个公钥对应的私钥对Transaction进行的签名
    Calculated public key which correspond to this transaction
  • 通过公钥获取操作者亦即我们说的真实操作者
    Get the real operator

欢迎讨论,欢迎指正。


感谢阅读 / Thank you for reading.
欢迎upvote、resteem以及 following me @oflyhigh 😎

Sort:  

I can tell you put some serious work into that post. Thank you my friend.

两年后追到此处,真奇幻,严重感谢

哈哈,客气了

Great post man :)

这次真的看不懂了,不明觉厉。更喜欢写的故事,有大片儿的既视感。

过奖了
写故事的感觉就像宋丹丹写《月子》,十天憋出来半个字......

good post

对不会PROGRAMMING的我很复杂啊。有没有可能做一个网页,我们输入URL: https://steemit.com/cn/@oflyhigh/get-real-operator-of-a-transaction-made-by-the-id-which-operated-by-multi-accounts-script-attached 然后就看到是@oflyhigh发表此帖。

网页是可以有的
不过还要主机啥的,挺麻烦的就是啦,😄

Nice Post , Thanks for Sharing. Upvoted and Followed. Have a Good Day. Cheers:)

You have a very thoughtful mind

thank you for sharing.

I wish I understood this post!

大!!感谢您与我们分享此信息。

Wow.. thanks for putting this together :)

Informative post

不错,这简直是一篇论文,你们这些老手们技术真高。感谢分享技巧。

that is a good informations. thank for the post.

woww buen post

show me in english please

Hello Friend Nice Post by You

Please see my post under the title
"Please Check the POST"
& Respond...

Thank you very much

What's that look like?