Earnings calculator (Update 2020-11-06: v9.4.1 - Uptime is back! Now compatible with v1.12+ and more verbose warnings)

I made this calculator to provide payout information and be used as an extension of the dashboard functionality already provided by Storj.

Storj Earnings Calculator

Earnings calculation script for Storj V3 storagenodes

Prerequisites

Python is required to run this script.

This script was tested on Windows 10 and Linux, with Python 3.7. Other OS’s and versions will likely also work.

Warning

If you are running Docker on Windows or MacOS, stop the node, copy the bandwidth.db, storage_usage.db, piece_spaced_used.db and reputation.db to a different location and run the script from there. Running the script on docker nodes on these OS’s while the node is using it could lead to corruption of the database, which will kill the node.

Usage

Earnings for current month:

python earnings.py /path/to/storj/data

Note: If you omit the path it will look in the current working directory.

Earnings for previous months:

python earnings.py /path/to/storj/data 2019-05

Screenshots

image

image

image
As this last screenshot shows, the calculator keeps track of detailed status. If one of the displayed scores goes over 100%, you will be disqualified or suspended, depending on which score. Vetting progress is also displayed. If any of the displayed scores go over 5%, the status will change to WARNING, signaling that your node needs attention. Under healthy conditions you want to see 0.0% for all scores, which is a perfect score.
Note: This deviates from how scores are displayed on the web dashboard.

Get latest version

Direct link (right click > save as):

https://raw.githubusercontent.com/ReneSmeekes/storj_earnings/master/earnings.py

From CLI:

wget https://raw.githubusercontent.com/ReneSmeekes/storj_earnings/master/earnings.py

Changelog

v9.4.1 - Uptime rounding fix

  • Fixes an issue where uptime percentages were rounded down to a whole percentage

v9.4.0 - Uptime is back

  • Fix for changes to databases with node release v1.12
  • Uptime scores are now included
  • Status display for uptime suspension and under review
  • More verbose warnings display what should be looked at
  • Layout changes for readability

v9.3.1 - Change hours per month to 720

  • Storj has started to use 720 hours per month in calculating payout, this update changes the earnings calculator to use the same

v9.3.0 - Status reworked, suspension added

  • Reworked the status display
  • Suspension scores (unknown audit scores) added
  • Warning when there might be an audit issue

v9.2.2 - Fix time range estimate end of month

  • Fixes the calculation for month progress to use actual number of hours in month instead of 730

v9.2.1 - Minor bug fixes

  • Fix in how percentages are displayed which could cause layout issues on some systems
  • Fixed an issue where the script checked for the wrong filename of heldamount.db leading to the script throwing a non-user friendly error message if this db is not found (Thanks @karaliux for the PR)
  • Fixed an instance where local time was used instead of UTC

v9.2.0 - Additional status information

  • Accurate joined date added
  • Month number calculation decoupled from paystubs; calculation is now based on the accurate join date
  • Current month: Suspension status added
  • Current month: More verbose status display including time of suspension/disqualification
  • Previous months: Payout notes added for nodes that have been disqualified, graceful exit, sanctioned countries and missing 1099 form

v9.1.1 - Bugfix and dependency removed

  • Fixed a bug that caused incorrect calculation of total held amount returned
  • Worked around dependency of statistics module

v9.1.0 - Held amount payouts

  • Held amounts are corrected for payouts in the past
  • Payouts of held back amount in the displayed month are shown and included in totals
  • Fixed a bug where the surge line would sometimes show up in the current month for no reason
  • Small changes to layout to improve readability

v9.0.2 - Fix surge payout prior 2019-09

  • Bugfix: Surge payout was not displayed for months with missing disk usage stats (prior to 2019-09)

v9.0.1 - Fix disk current

  • Previous version introduced a miscalculation of current disk usage. This version fixes it.

v9.0.0 - Surge, held amount, redesign sat breakdown

  • Requires storagenode version 1.3.3 (Data will be incorrect on older versions)
  • Requires heldamount.db, if you copy db’s prior to running the script, this one needs to be included now
  • Added surge payout information
  • Added held amount totals so far
  • Accurate display of month number for your node on each sat
  • Redesigned breakdown per satellite
  • Display only relevant held back % and amount and paid amount
  • Added totals for satellite breakdown

v8.2.1 - Added europe-north-1 satellite

  • Added europe-north-1 satellite

v8.2.0 - Price and month estimate

  • Adds price per TB for download and storage
  • Adds an estimate for total earnings for the current month

v8.1.3 - Terminology

  • Additional correction in terminology

v8.1.2 - Remove uptime score and align terminology

  • Removed uptime scores which always displayed 0 (May return when new uptime system is implemented)
  • Aligned some terminology with Storj documentation

v8.1.1 - Saltlake satellite added

  • Added the new saltlake satellite to the known list to get rid of the -UNKNOWN- satellite

v8.1.0 - First contact

  • Added first contact date to display when the node first dealt with each satellite
  • Made use of additional space to display slightly more descriptive uptime and audit scores
  • Optional note when first contact date is prior to May 2019. As nodes didn’t keep bandwidth history prior to some time in April, dates before May are not reliable. This is only displayed when dates before May 2019 are found.

v8.0.1 - Layout fix

  • Fixed a layout issue when displaying vetting progress on some python versions (Thanks @schnutzie helping me test)

v8.0.0 - Reputation update

  • Added status to show whether your node is OK or DQ (disqualified)
  • Status displays progress of vetting while still in vetting phase
  • Added uptime and audit scores (0-1000)
  • Code cleanup merged (Thanks @smurfix )

v7.0.1 - Cleanup output

  • Remove debug print lines
  • Made the script compatible with the split up sqlite3 databases
  • Changed readme to reflect the 3 databases required for the script to work

v7.0.0 - Compatibility with split database

  • Made the script compatible with the split up sqlite3 databases
  • Changed readme to reflect the 3 databases required for the script to work

v6.1.0 - Historic storage data

  • Storage information for historic months is now also available starting with September 2019
  • Small change in terminology for used storage to align with planned changes on the SNOboard (GBm instead of GB/Month, which was actually mathematically the wrong unit anyway)
  • USD amount is now shown on the Disk Average Month line

v6.0.0 - Big refactor with several updates

  • No more estimates for disk usage, it now uses the nodes own numbers
  • Switched Disk Average to usage so far based on Bh (Bytes*hour)
  • Added Bh line and switched the total line to Bh as well
  • USD calculation for disk usage now doesn’t assume usage will stay the same for the rest of the month and displays USD based on usage until now. Just like for bandwidth only USD made until now is displayed. This results in this version displaying a lower number than the previous version as future income is not counted yet.
  • Known satellites are now mentioned by name
  • Visual tweaks
29 Likes
How does "Disk Space Used This Month" work?
V0.21.1 removes some bandwidth information from dashboard API; please restore
AUG. 11, 2019: All monthly payouts have been completed
December payout
Hi, I have a question about uptime and payouts
Is my Subnet killing me?
Node 2 days working
Unable to gracefully exit (satellite.stefan-benten.de - connection refused)
Storj network bandwidth and storage
Graceful Exit Problem
And how i can make 4 nodes @ one pc?!
Bandwidth utilization comparison thread
Node Dashboard - Payout Information bytesh
"You can get € 400 (440 $ usd) a month, using a 2tb hard drive, giving storj a space of 1tb" - is it real?
Held amount gone ? Suddenly 50 % off on held amount?
Gracefull exit successfully - now Goodbye!
Bandwidth utilization comparison thread
Total Earned lost all my earns
June Payout Information has disappeared
Have I lost reliability at the node or am I penalized?
Held Back Amount
How many node do you have?
Payout feedback
June 10, 2020: May 2020 SNO payouts are complete
June 10, 2020: May 2020 SNO payouts are complete
The easiest way to check how long (since when) SN works?
How old is my node?
Graceful Exit & Query Satellite for Held Amount
Graceful Exit & Query Satellite for Held Amount
Configuración Multinodo
My node is disqualified
New Identity QNAP
When do we get paid after a successful graceful exit?
Help understanding payouts
Windows GUI Reports
Node Dashboard не показывает статистику
Calculation of held amount
April 2020 SNO payouts are complete
My experience with graceful exit
Extremely low payout for April
New node : No more data incoming since 05 may 00:00 am CEST (maybe vetting)
Storage Node Information
Total payout 0 for April
April was an interesting month, 2 PB*h and 6 TB ingest
How long has my node been up according to Storj?
Yet another post about earnings. (old user)
Am I out of the game?
March payment drastically low?
March payment drastically low?
Possibible problem with payout?
March payment drastically low?
Payment missing! PLEASE HELP!
How much can I earn with a 1GBit connection?
Missing Payouts?
Monthly payment receipt for Storage Nodes Operators
Is it possible to use the same wallet address for two different nodes running on different PCs?
Windows node hosting dashboard error
Is there any dashboard I can check that shows the current estimated earnings in order to verify that I am actually properly enroled?
Abysmal Upload Success Rate
Выплаты очень прозрачны
Graceful exit overshoot issue
MAR 10, 2020: Februay SNO payouts are complete
February payouts are coming!
Feb. 5, 2020: Monthly payouts for January, update
SSD or SD Card as Storage?Is the estimate payout option realistic?
Payouts by satellite greatly differ from each other
New to storj using windows10 gui
Helpful Storj Community Tools List
January 5, 2020: All monthly SNO payouts for December are complete
Has my node been vetted yet?
Storagenode had corrupted data in over 400 blocks on the hard-drive storage
[NEW NODE] Windows 10 - How to add more TB to NODE + VPN question
"piecestore protocol: out of space(...)" - action required?
Is there a way to see how much Storj tokens are kept in escrow
How can i Get all downloaded for month or uploaded?
No data in dashboard after migrating to new computer
Any plans for adding ability to check previous months periods stats [GUI]
Is there any way to identify which satellite the payment is from?
Possibible problem with payout?
Question about Storj Node
Earnings calculator with Pushbullet notifications
When will Stefan Benten satellite be removed?
Uptime score dropped to zero multiple nodes
Earnings.py script doesn't works
Changelog v1.14.1
Sep/Oct payments have started
Allow display in dashboard if the node is in vetted period
Negative held amount
Ability to see past months data ingress / egress graphs on webdash

This version runs FAST!

2 Likes

Yep, since they introduced bandwidth rollups in the db there is much less data to go through. I wish I could claim that improvement, but that’s all storjlabs. I just changed the script to use the new tables.

4 Likes

Thank you for this helpful tool!

Just a thought: it would be even easier if the tool handled itself all the preparation:

  • stop the node
  • copy the info.db in a temporary directory
  • run the calculator algorithm
  • delete the file
  • restart the node

Why do you think?

1 Like

To be honest, I think it’s probably safe to run it on a live db on linux. That’s how I’ve been using it for months now. I just felt really bad when people using my script ended up with a corrupted database, so I didn’t want people to take the risk. On windows and macos you really shouldn’t do that though. I could make the script to do everything you mentioned, but it’s kind of trivial to make a script for it yourself and everyone is using different paths and container names.

For linux systems it’d be something like this. This may even work as a powershell script as well, since powershell adopted a lot of the linux commands. So yeah, adapt these lines, put it in a .sh or .ps1 and you’re done. But please test first… as I just wrote this untested.

docker stop -t 300 storagenode
cp /path/to/info.db /path/to/infodbcopy
docker start storagenode
python earnings.py /path/to/infodbcopy
rm /path/to/infodbcopy/info.db
2 Likes

Thanks. I got this to work. Very helpful.

Like others I suspect, my actual and projected payouts are much lower than the Storj V3 earnings calculator suggested - even though I have a fast Internet connection. But that’s another discussion for elsewhere.

2 Likes

Thank’s for the good work and bring to us a tool that should be included in the dashboard.

There is a reason for start the node after the earnings script? I usualy start the node after the database copy for keep the downtime as low as possibile.

1 Like

Starting after copy is fine too. The time difference is minimal though. But I changed it in my previous post.

1 Like

I have a nice little update today. I noticed that the info.db actually stores storage data from previous months now. Last month it looked like it was there for one month only, but that likely was just because this way of storing the data was started that month. Long story short, starting with September 2019, historic data is now available, meaning that your historic totals should now reflect actual payouts!

Today’s update incorporates changes to actually display that storage information and adds a warning about the missing information for months prior to September 2019. There are some other tweaks as well. Enjoy!

v6.1.0 - Historic storage data

  • Storage information for historic months is now also available starting with September 2019
  • Small change in terminology for used storage to align with planned changes on the SNOboard (GBm instead of GB/Month, which was actually mathematically the wrong unit anyway)
  • USD amount is now shown on the Disk Average Month line
3 Likes

It works like a charm!
Thank you so much for this very usefull tool! It would be great if Storj teams decided to inculde it natively :slight_smile:

1 Like

Already suggested that and more on the Node Dashboard UI/UX Feedback topic :smiley:

1 Like

Our Storj friends love to throw me curve balls with updates to the database structure for storagenodes. But they’re not getting me that easily! :laughing:

v7.0.0 - Compatibility with split database

  • Made the script compatible with the split up sqlite3 databases
  • Changed readme to reflect the 3 databases required for the script to work
1 Like

@Alexey you may want to update the reference to info.db at the bottom of this page as well.


It now requires bandwidth.db, storage_usage.db and piece_spaced_used.db to be copied.

btw… is that a typo in piece_spaced_used.db? That’s actually what the file is called.

2 Likes

Love this latest version, it rocks!

1 Like

Maybe a stupid question: Why do we have some “NOT PAID” lines?

1 Like

Because ingress traffic isn’t paid and storage is paid only once. I have multiple metrics for storage in there that basically descrive the same thing in different units. The currently stored amount is just what’s stored at this moment. And then there is the average over the entire months and GBh. Since payment is based on the average over the entire months, that line now lists the actual amount.

1 Like

I have these 2 lines since version 7.0.0 at the top of the output when I run the script.

<sqlite3.Cursor object at 0x7fe9cea99570>
<sqlite3.Cursor object at 0x7fe9cea99570>

Are these error messages or what else do they mean?

2 Likes

No, they’re me being an idiot and leaving in some debug code in the version I put on github. Thanks for pointing it out. Fixed it with a minor release.

v7.0.1 - Cleanup output

  • Remove debug print lines
4 Likes

Do the estimated earnings take into account the surge payout (x4 for July, August, September, October)?

Thanks!

1 Like

No, This is before surge. The surge payouts are different depending on how old your node is. I get 5x because my node existed prior to surge going into effect. I pondered including it but eventually decided against it since this is only temporary.

2 Likes