Hi there, Today I had a bit of free time and I spent it in update an old script I publish a while ago on github. The script used the `steem` library to operate so it was impossible to use the same commands both for `steem` and `hive`, so the necessity to update it. Now it uses the `beem` library like all of my scripts and bots ahaha. [very good job indeed @holger80] The script is very simple, and parse the last hours blocks to detect the users that interact with the blockchain, it clean the list from double and save the list in a file, the process is repeated every hour. This script allow you to see the hour active, the new ones and the total saved. ```python from beem import Steem from beem.blockchain import Blockchain from beem.nodelist import NodeList import time import re def hour_active(chain): nodelist = NodeList() nodelist.update_nodes() if chain=='steem': s = Steem(node=nodelist.get_steem_nodes()) else: s = Steem(node=nodelist.get_hive_nodes()) b=Blockchain(s) bl_=[] bl_num=int(b.get_current_block_num()) bl_num_=bl_num-1250 bl=b.blocks(bl_num_,bl_num) for i in bl: bl_.append(i['transactions']) x=('follower','account','voter','from','author') account=[] new=[] for i in x: acc=re.findall('"'+i+'":"(.+?)"',str(bl_)) for l in acc: if l not in account: account.append(l) if chain=='steem': file=open('active_acc_steem.txt','r') old=file.readlines() file.close() file=open('active_acc_steem.txt','a') for i in account: if i+'\n' not in old: file.write(str(i)+'\n') new.append(i) file.close() else: file=open('active_acc_hive.txt','r') old=file.readlines() file.close() file=open('active_acc_hive.txt','a') for i in account: if i+'\n' not in old: file.write(str(i)+'\n') new.append(i) file.close() print ('one hour accounts '+chain,len(account)) print ('one hour brand new '+chain,len(new)) print ('total ACTIVE accounts '+chain,len(old)) counter=1 while True: print (counter) try: hour_active('steem') hour_active('hive') except Exception as e: print (e) pass counter+=1 print ('__________________________') time.sleep(3580) ``` Here the repo on github: https://github.com/digital-mine/get_steem_active_users Here an example output of 1 hour cicle: 
author | the.journal | ||||||
---|---|---|---|---|---|---|---|
permlink | python-script-to-save-and-compare-active-users-on-steem-and-hive | ||||||
category | steem | ||||||
json_metadata | {"app":"peakd/2020.06.2","format":"markdown","tags":["steem","hive","script","python","developer","code","learn"],"users":["holger80"],"links":["/@holger80","https://github.com/digital-mine/get_steem_active_users"],"image":["https://files.peakd.com/file/peakd-hive/the.journal/Z1Ts1S4k-1oraapp.png"]} | ||||||
created | 2020-06-29 15:43:48 | ||||||
last_update | 2020-06-29 15:43:48 | ||||||
depth | 0 | ||||||
children | 1 | ||||||
last_payout | 2020-07-06 15:43:48 | ||||||
cashout_time | 1969-12-31 23:59:59 | ||||||
total_payout_value | 0.000 HBD | ||||||
curator_payout_value | 3.101 HBD | ||||||
pending_payout_value | 0.000 HBD | ||||||
promoted | 0.000 HBD | ||||||
body_length | 3,035 | ||||||
author_reputation | 5,799,246,878,950 | ||||||
root_title | "Python script to save and compare active users on steem and hive" | ||||||
beneficiaries |
| ||||||
max_accepted_payout | 1,000,000.000 HBD | ||||||
percent_hbd | 10,000 | ||||||
post_id | 98,244,474 | ||||||
net_rshares | 17,614,094,664,729 | ||||||
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
tykee | 0 | 1,837,059,781 | 36.5% | ||
bob-elr | 0 | 1,555,071,746 | 100% | ||
kamchore | 0 | 125,549,504,701 | 36.5% | ||
neupanedipen | 0 | 25,925,215,982 | 100% | ||
bala41288 | 0 | 37,710,050,555 | 14.6% | ||
theophile.roos | 0 | 2,393,758,630 | 100% | ||
digital.mine | 0 | 17,359,549,900,485 | 100% | ||
laissez-faire | 0 | 41,020,327 | 100% | ||
nelsonnils | 0 | 1,577,102,264 | 100% | ||
sreypov | 0 | 6,424,114,517 | 62% | ||
gitplait | 0 | 51,531,865,741 | 73% |
Knowing active user is very important to perform swot analysis. Thanks for publishing python script. We are looking for people like you in our community <sub> Your post has been submitted to be curated with @gitplait community account because this is the kind of publications we like to see in our community. </sub> Join our [Community on Hive](https://hive.blog/trending/hive-103590) and Chat with us on [Discord](https://discord.gg/CWCj3rw). [[Gitplait-Team]](https://gitplait.tech/)
author | gitplait-mod1 |
---|---|
permlink | qcp7p4 |
category | steem |
json_metadata | {"users":["gitplait"],"links":["https://hive.blog/trending/hive-103590","https://discord.gg/CWCj3rw","https://gitplait.tech/"],"app":"hiveblog/0.1"} |
created | 2020-06-29 17:39:09 |
last_update | 2020-06-29 17:39:09 |
depth | 1 |
children | 0 |
last_payout | 2020-07-06 17:39:09 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 488 |
author_reputation | 64,455,719,431 |
root_title | "Python script to save and compare active users on steem and hive" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 98,246,076 |
net_rshares | 0 |