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 satellites.db, bandwidth.db, storage_usage.db, piece_spaced_used.db, reputation.db and heldamount.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 2023-03
Screenshots
Note: Screenshot is from an older version, layout has changed, but the warnings remain similar
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 WARN, 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
v14.1.0 - Garbage collection progress
- Add feature to show garbage collection progress
v14.0.0 - Compatibility with storagenode v1.104 and up
- Breaks compatibility with node versions v1.103 and below.
- Compatible with v1.104 and up
- Fix an issue with including empty records in satellite stats
- Add a note during first days of the month or when deviations are detected that satellite stats may be temporarily unreliable
Older versions
v12.3.1 - Fix division by 0 for storage usage not available
- Fixes an issue where the script caused a division by 0 error if any satellite hasn’t yet reported any storage usage within the given month
v12.3.0 - Stabilized disk average so far and end of month estimate
- Use byte hour timeframes to determine exact time over which disk usage has been reported so far to stabilize disk usage reporting and end of month estimates
- Includes changes from unreleased versions below
v12.2.0 - Replace disk usage in Bh with average disk usage so far (unreleased)
- Disk usage displayed in Bh has been dropped. As this is no longer displayed on the official dashboard it no longer serves a useful purpose
- Disk average so far has been added to display the average amount stored on the node over the course of the month
v12.0.1 - Fix suspension threshold (unreleased)
- Fix has been implemented to correct erroneous change to new suspension threshold. The change was only valid for audit scores
v12.0.0 - Compatibility with node version 1.62+
- Fixes error on new node version > this version is only compatible with node version 1.62+
- Implements new scoring threshold into audit and suspension scores (As before, a score of 0% means you’re good, 100% means you’re suspended or disqualified)
v11.2.0 - Fallback satellite names (unreleased)
- Adds fallback for satellite names for new nodes (It takes up to 24 hours before satellite names are available in the node db’s)
v11.1.0 - Adjusted linear audit progress percentage
- Audit progress was adjusted based on community feedback
v11.0.0 - Redesign + dynamic satellite names
- Pull satellite name from database
- Redesign payouts table
- Note: Satellites.db is now required to run the script
v10.4.0 - Add zkSync bonus
- zkSync bonus has been added for nodes using zkSync for payouts for October 2021 and later
v10.3.0 - QA satellite added
- QA satellite added
v13.4.0 - Uncollected Garbage & Total Unpaid Data
- Added Uncollected Garbage, which shows an estimate of how much data is stored in blobs, but hasn’t been collected by garbage collection. Uses Last Disk Report and Disk Current Blobs to calculate.
- Added Total Unpaid Data, which is the sum of Trash and Uncollected Garbage.
v13.3.0 - Disk size last reported by satellites & reported by source
- Added Disk Size Last Report, which shows a disk size calculated on the most recent disk usage report sent by the satellites. This is the most accurate representation of how much the satellite currently thinks you store and pays you for.
- Added REPORTED BY column to show which values are calculated using local node data and which are calculated using reports from the satellites.
v13.2.1 - Fix wrong calculation for Trash
- Fixes a wrong calculation for trash, introduced in v13.2.0
v13.2.0 - Add trash details & replace deprecated utcnow() function
- Adds additional details for Disk Current, splitting out Trash and Blobs, for easier comparison with satellite reported Disk Average So Far
- Replaced the now deprecated function utcnow() with functions compatible with the latest python versions
v13.1.0 - Change zkSync bonus & fix forgotten satellites
- zkSync bonus has been adjusted to 3% to match recent change. (Note this will apply to older months as well)
- Worked around missing data for satellites which have been forgotten using the forget-satellite function so you can still view data from old months, using fallback names for satellites
v13.0.3 - Work around erroneous storage usage reports
- Implements workaround for erroneous storage usage reports by satellites to limit impact on storage usage and end of month estimate numbers
v13.0.2 - Fix inconsistent end of month estimation
- Fixes an inconsistency of how end of month payouts are calculated in the top and bottom overview
- Improves accuracy of end of month estimated payout for storage
v13.0.1 - Fix issue with vetting status
- Fix wrong display of vetting status introduced in v13.0.0
v13.0.0 - Refactor for different payout schemes per satellite
- Calculate weighted average payout per TB for top overview
- Add payout scheme per satellite
- Split out payouts for storage, egress and repair/audit
- Add estimated total by end of month to per satellite overview
- Change layout to keep output compact with newly data added
- Source payout data from pricing.db instead of hard coded (note: new db required to use the script)
v10.2.1 - Fix: 0 lines showing for rounding errors
- Implements a small fix for lines with 0 showing up in case of float rounding errors
v10.2.0 - Non-linear vetting progress
- Implemented a new algorithm to account for the non-linear progress of vetting, which should give a better indication of how long is left in vetting
v10.1.2 - New storj.io satellite names
- Updated to use the new satellite names
v10.1.1 - Fix payout previous month
- Payout previous month didn’t take into account what was paid out in the month you are looking at; this has been corrected
v10.1.0 - zkSync transaction link support
- Added support for displaying zkSync transaction links
- Removed warning about stefan-benten payouts being reported as “postponed” as storagenode update v1.24.4 will correct the misreporting
- Added shebang so the script can be run without explicitly calling python3 on supported systems
v10.0.0 - Detailed payout information
- Added amounts of actual payouts
- Added difference between calculated payout and actual payout (helps to identify possible payout issues)
- Added postponed payout information
- Added transaction link
- Several tweaks and additional information related to the above
v9.5.0 - Cleaned up layout
- Moved more to a single line layout to improve readability
- Created column groups with descriptive headers
- Uptime changed to down time to align with 0% = perfect, like the other scores
v9.4.2 - Satellite us2 added
- Added the us2 satellite name
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