LeoFinance witness - How many have earned more than 1000 LEO this month but haven't voted Leo as witness? -Python code + DATA and CHARTS
Good evening to everyone , I hope you all are having a great day .
Onboarding
We all know how much LeoFinance team has done regarding onboarding of people . I am not here to talk about that , the thing I want to mention in this post is - how can we help LeoFinance team in this regard?
One obvious way is to delegate our HP to @leo.voter so that HP available in that account is used to delegate to new users .
I am here to talk about the second way , let's get LeoFinance in top 20 - that way the Block producer reward will keep on adding HP to LeoFinance more than what they are gaining right now at 30th position .
Note: For those who isn't interested in codes , skip to the end of post for results.
# Proxy and No proxy accounts
Proxy accounts are those which haven't directly voted for witness but have used proxy to vote for witnesses indirectly .
Non-Proxy are those who have voted by themselves.
First , I gathered all the data from TxAccount table from HiveSQL and bifurcated the account with proxy and without proxy and stored it in CSV file .
The following data is used to retrieve the data from CSV and store it in DataFrame.
import pandas as pd
from datetime import datetime as dt
without_proxy = pd.read_csv('Without_proxy.csv')
Table looks like this -
What we need to look for is - witness_votes column -
No Proxy account
witness_list=[]
for j in range(0,len(without_proxy)):
list_generator= list(without_proxy['witness_votes'][j].split('\r\n'))
if list_generator:
for i in range(0,len(list_generator)):
list_generator[i]=''.join(e for e in list_generator[i] if e.isalnum())
list_generator= list(filter(None, list_generator))
witness_list.append([without_proxy['name'][j],list_generator])
What have I done above?
going through every row ( which contains details of who a particular user has voted for as witness)
it contains some unnecessary data like \r\n so I have cleansed it and stored it in pure username form
I have stored that in a list in the following format
- Username : Witness votes
- Ex :
- Here 'hope777' is the account name and the next list is whom he has voted for as witness.
voted_for_leo_list=[]
not_voted_list=[]
for i in range(0,len(witness_list)):
if 'leofinance' in (witness_list[i][1]):
voted_for_leo_list.append(witness_list[i][0])
else:
not_voted_list.append(witness_list[i][0])
In the above code
- I have just checked if LeoFinance is one of the votes by the user .
- If yes , I have stored his name in voted_for_leo_list
- If no , I have stored his name in not_voted_list
That is it for ' No proxy account votes ' . Now let's jump to ' Proxy accounts '
with_proxy = pd.read_csv('With_proxy.csv')
for i in range(0,len(with_proxy)):
proxy_name=with_proxy['proxy'][i]
if proxy_name in voted_for_leo_list:
voted_for_leo_list.append(with_proxy['name'][i])
else:
not_voted_list.append(with_proxy['name'][i])
Steps
- I have stored taken user and his proxy .
- I have stored the proxy name in proxy_name .
- I have checked if the proxy_name have voted for leofinance by referring to above voted_for_leo_list
- If yes , I have appended the user name to voted_for_leo_list
- If no , I have stored his name in not_voted_list .
Now I have used Hive-Engine API to gather the data of how much they have earned from Jan 1 to Jan 26.
import shelve
s=shelve.open('Blocks\Blockchain') # Where I store all 2nd layer tx details
df=pd.DataFrame.from_dict(s.items()) # Converting to DataFrame
df.columns=['Blocks','Transactions'] # Renaming the columns
import json
leo_earned_list=[]
for i in range(0,len(df)):
if(df['Transactions'][i]['Transaction']['action']=='issue'):
json_logs=json.loads(df['Transactions'][i]['Transaction']['logs'])
if 'events' in json_logs:
if(json_logs['events'][0]['data']['symbol']=='LEO'):
leo_earned_list.append([json_logs['events'][0]['data']['to'],json_logs['events'][0]['data']['quantity'],df['Transactions'][i]['Transaction']['sender']])
Steps
- I have filtered first by taking transactions which has action as 'issue'
- I have taken logs and have stored the data for only LEO symbol .
The output looks like this -
Since we need all the LEO issued to particular user from Jan 1 to Jan 25 , I have used groupby username and sum() , this will give us -
df_total_leo_earned=df_leo_earned.groupby('to').sum().reset_index()
output -
LEO earned in this month from Jan 1 to Jan 25
list_less_100=[]
list_100_1000=[]
list_more_1000=[]
for i in range(0,len(df_total_leo_earned)):
if(df_total_leo_earned['quantity'][i]>100 and df_total_leo_earned['quantity'][i]<1000):
list_100_1000.append(df_total_leo_earned['to'][i])
elif(df_total_leo_earned['quantity'][i]<=100):
list_less_100.append(df_total_leo_earned['to'][i])
else:
list_more_1000.append(df_total_leo_earned['to'][i])
This is pretty simple , I have segregated accounts based on amount of LEO earned .
- Those who have earned less than 100 , their names are stored in list_less_100 .
- Those who have earned between 100 and 1000 , I have stored in list_100_1000 .
- Those who have earned more than 1000 , I have stored in list_more_1000 .
If I count the number of users -
print('Less than 100 LEO earned = '+str(len(list_less_100)))
print('Earned between 100 and 1000 = '+str(len(list_100_1000)))
print('Leo Earned more than 1000 = '+str(len(list_more_1000)))
Output -
Less than 100 LEO earned = 2421
Earned between 100 and 1000 = 152
Leo Earned more than 1000 = 45
Now comes the main part - How many users have voted to LeoFinance ?
count_less_100=0
count_100_1000=0
count_more_1000=0
for i in list_less_100:
if i in voted_for_leo_list:
count_less_100+=1
for i in list_100_1000:
if i in voted_for_leo_list:
count_100_1000 +=1
for i in list_more_1000:
if i in voted_for_leo_list:
count_more_1000 +=1
Steps
- I have just taken users and seen if they have voted or not , that's it .
Data and Charts
So for all those people who just hated the above part and just want to know the final result -
this is it -
Total voted for Leofinance who have earned less than 100 :535
Total voted for Leofinance who have earned between 100 and 1000 :93
Total voted for Leofinance who have earned more than 1000 :19
Not voted for Leofinance but who have earned less than 100 :1886
Not voted for Leofinance but who have earned between 100 and 1000 :59
Not voted for Leofinance but who have earned more than 1000 :26
Those who have earned less than 100 LEO , witness votes proportion.
Those who have earned between 100 and 1000 LEO , witness votes proportion
Those who have earned more than 1000 LEO .
What do you think of the above ?
I also tried to see how much Vests resides in the accounts who have earned over 1000 LEO .
*Note: Only over 1000 LEO , not the other two , if we calculate the total VESTS - we get this '
sum_vests=0
from beem.account import Account
for i in final_list1:
account = Account(i)
sum_vests=sum_vests+(float(str(account.balances['total'][2]).split(' ')[0]))
for i in final_list2:
account = Account(i)
sum_vests=sum_vests+(float(str(account.balances['total'][2]).split(' ')[0]))
for i in final_list3:
account = Account(i)
sum_vests=sum_vests+(float(str(account.balances['total'][2]).split(' ')[0]))
sum_vests
Update : I have just updated for all 3 lists -
Output - 35242666163.46122 VESTS .
In HP - 18 M HP.
Thank you for reading , let me know what you think about this in comments .
Regards,
MR.
Posted Using LeoFinance Beta
That's very interesting.
I think that's about 1 436 993.75 Hive Power currently not voting for Leo Finance.
I think it's about 1903 Vest to 1 HP.
I may be wrong about this, but 1.4 M HP sounds about right.
Probably not enough to lift LEO into the T20 - I think a witness needs one of the top 2 accounts voting for them to guarantee it.
But even so you would have thought everyone whose earning on here would vote leofinance as a witness!
Posted Using LeoFinance Beta
Agreed, I thought those whales would definitely vote for it as a witness. On a side note, I should probably fill up the other 20 empty witness votes sitting on the side for my account but I have been too lazy to research into it. I mainly voted for things that I currently use.
Posted Using LeoFinance Beta
This is important .
But this is most important.
I too have some slots left but I only vote those whose work I know or have come across. I should also fill it soon by researching.
Posted Using LeoFinance Beta
It's good to use them all up!
Posted Using LeoFinance Beta
I hear what you are saying. For me it's about the intent to support the platform . That is why I have calculated the vests for only those who earned more than 1000 LEO this month and not less than that.
There might be people who are earning less than 100 LEO but still have voted it as witness ( example - me ) .
1.4 M HP as you said might not get Leofinance above 20 but we aren't calculating proxy here. What if these people ( whales ) are set as proxy by other users ?
Did I make any sense?
Posted Using LeoFinance Beta
Yes you're making sense - I can't imagine proxy votes would make that much difference!
I don't think many people proxy their witness votes out.
Posted Using LeoFinance Beta
That's exactly what I thought but wait let me show you the data -
Voted for LeoFinance directly without proxy - 878
Voted for LeoFinance through proxy - 1664
Almost double .
Posted Using LeoFinance Beta
Although is that accounts, do you have the HP figures?!?
Posted Using LeoFinance Beta
Even before I was actually posting/commenting on Leo, I voted for the Leofinance witness. I did so because the google search results gave me more accurate results compared to the rest. I am kind of surprised there are so many people who make over 1k who didn't vote but those in the 100-1k range is a bigger percentage.
Posted Using LeoFinance Beta
Yes that did surprise me too. But it is what it is.
Posted Using LeoFinance Beta
Great post. I was thinking that Leo could advertise their witness a bit more. I believe it would be great if more people voted for leo so that it gets a spot in top 20.
Posted Using LeoFinance Beta
You are right but I think it is more on us ( the users )than the team to voluntarily take action don't you think?
It's like voting in real life , it's not only a privilege but also a duty( unless the election is rigged) .
Thanks for stopping by and sharing your thoughts:)
Posted Using LeoFinance Beta
You are totally right that it's up to us. Unfortunately a lot of users are not aware of the fact that they can influence life on the blockchain a lot with their votes.
I completely agree with you.
Posted Using LeoFinance Beta
Can we compile the list of those who are not voting so we can contact them and get them to vote?
Posted Using LeoFinance Beta
I have the complete list of usernames who have voted and who haven't . I thought it is better not to mention them in the post because they might get offended.
Posted Using LeoFinance Beta
Well it is public information. It is not as if we cant go to the witness voting page and see the names.
It is just a pain in the ass to manually cross reference with the parameters you pulled up.
As for getting offended, it might help. If they are getting compensated with Leo yet do not support the witness node, then perhaps they dont merit the support of upvotes.
By my calculations, the witness server for Leofinance needs about 21 million more HP.
Some of those people can help move it closer.
Posted Using LeoFinance Beta
You know I had put the table of who haven't voted and just deleted at the end.
Since everything is transparent , you are right it will help if we can contact them.
It's almost midnight here -
In the morning I will post it in the comments here , what do you say?
Posted Using LeoFinance Beta
While I don't totally understand all the code stuff I do understand the charts and I think its sad that so many users who have earned so much has not voted and those who have earned the least has voted. In my opinion those high earners seem to just want their share and don't care about supporting Leo completely. It only takes a minute to vote so why haven't they voted?
Posted Using LeoFinance Beta
I actually replied to you earlier I don't have any idea where it went lol.
Anyway let me post again, the codes are for those who knows it to cross check the data retrieved.
The charts are for everyone.
I have no answer to this.
Most probably lack of awareness? Or laziness?
Posted Using LeoFinance Beta
If all of those who didn't vote yet would vote for LeoFinance, in which place will LeoFinance be?
Posted Using LeoFinance Beta
As @revise.leo mentioned , it will only add 1.4 M HP from those who have earned 1000 LEO or more but if we take everyone who is even earning 1 LEO then we will add more than that and most probably will break the Top 20 .
Posted Using LeoFinance Beta