I just spent like 4 or more hours trying to calculate the value of a vote in Hive/HBD... (I still don't know how pls send halp)

in GEMS3 years ago

image.png

@penguinpablo's hive vote calculator on hive-now.com

I know there must be some formula out there to calculate the STU / Hive Rewards / Vote Value. I know it includes a few things, such as

  • the price of hive
  • the reward balance of the blockchain
  • the total recent claims
  • total hive power
  • vote mana
  • vote weight
  • delegations coming in and out
  • date
  • total vesting fund
  • total vesting shares

There's a formula here but it just doesn't give me a Hive Rewards final value. It gives something like 4179.like 10 decimals. But this calculator says my full vote is 0.51 at 100% mana and weight.

I tried to copy that calculator's code, but @penguinpablo minified it and it's not open source :CC

The following is my attempt at deciphering his minified code. I failed. It gives me -3578169634870.7144 (which is definitely not my vote size lol)

image.png

I'll show some of my failed attempts:

image.png

image.png

image.png

Yeah I might need some help. XD reeeeeeeee so much time

if anyone knows, or knows someone who knows, pls gib formula?

Sort:  

Lol it's almost May 2022 and I am struggling with this...

OMG I can't! I have been trying since I joined years ago hahah.

I know it has something to do with the available rewards pool shares.

If you manage to calculate it please tell me :'C it's the main thing stopping me from making a Hive frontend! I already have most of the rest.

I actually implemented it, but in Python. Do you want me to rewrite it in JavaScript and share with you?

Yes, please do that! It will be super super useful

https://peakd.com/hive-139531/@mciszczon/calculating-the-usd-vote-value

Hey, I wrote a post where I included the code and also added a few words of comment. Hope the code will be useful for you! If you need any help just let me know!