SteemFlag A project to analyse Steemit downvote history
SteemFlag is a website for analysing the downvote history of a Steemit user. With this tool, the user can :
- Analyse which users are downvoted by selected user
- Analyse what is the total downvote power used, in total and exactly on which user
- Analyse if the downvote power is mostly used on minnows, dolphins or whales
- Discriminate if the user is flagging spams or is in a flag fight with some other user
The website is coded in HTML and JavaScript and it is working at client side. Not to mess with the asynchronous functions, the usage is set to be mostly manual.
-
Goto SteemFlag website.
-
Press the " Search Data " button to start searching downvotes
-
After first part of data is on the page, press " Get Stats " button to read the stats of the people downvoted.
This will show the flagged persons SP and define if he/she is a minnow, dolphin or whale.
-
This will calculate :
- How much downvote power is used on minnows
- How much downvote power is used on dolphins
- How much downvote power is used on whales
The project is written in HTML and JavaScript using steem.js API. It is an open-source project and the code can be found in GitHub: https://github.com/firedreamgames/steemflag
The code working is basically as follows : First we have to get the steem data
steem.api.getDynamicGlobalProperties(function(err, result) { document.getElementById("vesting_shares").innerHTML = result.total_vesting_shares; document.getElementById("vesting_fund").innerHTML = result.total_vesting_fund_steem; }); This is used to calculate the SP of the downvoter and the downvoted user.
Then we calculate the SP of the downvoter.
steem.api.getAccounts([flagger], function(err, response) { console.log(response); vesting_shares = response[0].vesting_shares.split(' ')[0]; delegated_vesting_shares = response[0].delegated_vesting_shares.split(' ')[0]; received_vesting_shares = response[0].received_vesting_shares.split(' ')[0]; total_vesting_shares = document.getElementById("vesting_shares").innerHTML; total_vesting_fund_steem = document.getElementById("vesting_fund").innerHTML; console.log(vesting_shares, delegated_vesting_shares, received_vesting_shares); var steem_power = steem.formatter.vestToSteem(vesting_shares, total_vesting_shares, total_vesting_fund_steem); var delegated_steem_power = steem.formatter.vestToSteem(received_vesting_shares - delegated_vesting_shares + ' VESTS', total_vesting_shares, total_vesting_fund_steem); document.getElementById("txt_fp").innerHTML = (steem_power + delegated_steem_power).toFixed(2); });
We get the flagged posts with getAccountHistory
steem.api.getAccountHistory(flagger, -1, 10000, function(err, result) { console.log(result.length); for (let i = 0; i < result.length; i++) { if ((result[i][1].op[0] == 'vote') && (result[i][1].op[1].voter = flagger) && (result[i][1].op[1].weight < 0) && (result[i][1].op[1].author != flagger)) { document.getElementById("vic_name").innerHTML = document.getElementById("vic_name").innerHTML + result[i][1].op[1].author + "
"; document.getElementById("vic_SBD").innerHTML = document.getElementById("vic_SBD").innerHTML + (result[i][1].op[1].weight / 100) + " %" + "
"; } } });
With a function similar to above one, we calculate the SP power of each downvoted user and determine if he/she is a minnow, dolphin or whale.
Then we read the data from the innerHTML ( this way function is sychronized ) and calculate the downvote totals for each group and write in the assigned div.
Flagging can be and is used for many reasons in Steemit.
- To punish spam post
- As an attack
- As a defense against attackers It is important to have a handy tool to analyse users behaviours to use the downvote option.
The project is planned to be extended to:
- Work in a selected time slot
- Convert the % downvotes to SBD and see how much reward is downvoted.
- Cancel manual operation and use promises to handle asynchronous functions.
The project needs contribution on
- Asynchronous function solution, so cancel 3 buttons to 1 calculate button
- Formulation and script to convert %downvoted to SBD stripped
- Timeslot selection to see daily, weekly or any time performance of downvote.
Task requests will be opened on these 3 issues.
- BEFORE
The project was working manually due to async function problem in Steem.js API.
3 buttons to be used simultaneously visualy confirming data is loaded to div.
- AFTER
Async. function problem solved with call to external function.
var flagger = document.getElementById("input_flagger").value steem.api.getAccounts([flagger], function(err, response) {
The result is sent to an external function. No promise or callback used.
calc(result,flagger); });
This way the manual operation is cancelled and the DIV is loaded automatically. We have the complete RESULT array in CALC function to operate.
Additionally, a "SPINNER" to the upper left corner is added to inform the user he has to wait.
- BEFORE
There was no date selection, the data was analysed as from the beginning. Hence, there exists a limitation for 10 000 data.
- AFTER
Date selector is added to the project. With selected date, the data is seperated in FOR loop with IF statement.
for (let i = 0; i < result.length; i++) { if ((result[i][1].op[0] == 'vote') && (result[i][1].op[1].voter = flagger) && (result[i][1].op[1].weight < 0) && (result[i][1].op[1].author != flagger)&&(result[i][1].timestamp>selectedDate)) {
With above code, the downvotes "after the selected date" is filtered.
- BEFORE
Hyperlinks of the downvoted posts didn't exist.
- AFTER
Hyperlinks are added, so user can see the downvoted posts and comments.
var str ="https://steemit.com/@"+result[i][1].op[1].author+"/"+result[i][1].op[1].permlink; var lin=(result[i][1].op[1].permlink).substring(0,70)+".......";
Hyperlinks are limited with 70 characters to fit the DIV.
- BEFORE
Analysis were limited.
- AFTER
Analysis is shown in a seperate modal window, full sorted from maximum times downvoted user to minimum.
The sorting code :
GitHub : https://github.com/firedreamgames/steemflag
WebPage : https://steemflag.neocities.org