So I've got a whole bunch of "little" scripts that I use from time to time. Some actually do things, others just return me some data that I might be interested in looking at. I decided that it might be a good idea to share some of them, so that people(especially future me) have something to refer to in the future on how to do certain things. I've learned some things and knowledge should be shared. These might not be perfect, probably don't follow convention, some might even have errors in them(if you see anything that can be improved/is wrong, please point them out) but should hopefully be good reference to others in the future. I won't go over everything line by line(unless someone asks in the comments) but will try to explain the basic logic behind it. If they need to get updated and I remember, I'll update them. So let's start with the first one, my witness rank and amount needed to rank up script that I wrote last night. This was written in JS and is currently live on a repl.it at https://repl.it/@Rishi556/Hextech-HP-Required-Count#index.js or see the live data at https://Hextech-HP-Required-Count.rishi556.repl.run. ```js let hive = require("@hiveio/hive-js") hive.api.getWitnessesByVote("", 100, (err, result) => { // start, limit let last = 0 //How much stake vote the person ahead of us has let us = 0 //How much stake vote we have let rank = 0 //Our rank for (i in result) { rank++ if (result[i].owner == "hextech") { us = parseInt(result[i].votes) / 1000000 //We are dividing by 1000000 because the data returned omits the decimal point. Hive goes to 6 decimal places for VESTS and so we need to divide by 1000000 to get it back to the right amount break } last = parseInt(result[i].votes) / 1000000 } hive.api.getDynamicGlobalProperties((err, properties) => { let total_vesting_shares = properties.total_vesting_shares let total_vesting_fund = properties.total_vesting_fund_steem //I assume this will have its name changed soon let total = hive.formatter.vestToHive(last - us, total_vesting_shares, total_vesting_fund) //This is the built in function to convert VESTS to HIVE. (the amount of vests you want to convert, total vesting shares as received from properties, total vesting fund as received from properties) console.log(`Current Rank : ${rank}\nRequired To Rank Up: ${total.toFixed(3)} HP OR ${(last - us).toFixed(6)} VESTS`) process.exit(0) }) }) ``` So this script gets the top 100 witnesses(if your witness is lower than that, you'd need to either change the start witness, or increase the limit), and then uses the stake value received to it and the witness above it to calculate how much VESTS are needed to rank up(also formatted as HP to make life easier). And here's our result. ![Screen Shot 20200712 at 3.53.03 AM.png](https://files.peakd.com/file/peakd-hive/rishi556/2wHXohO5-Screen20Shot202020-07-1220at203.53.0320AM.png)

See: My Scripts 1- Witness Rank And Amount Needed To Rank Up by @rishi556