steem-cointracking: Generate complete transaction history for STEEM
Tax season is upon us here in Norway, and with it comes updated guidelines for how to treat cryptocurrencies. Because of that I decided to start using CoinTracking.info, (which I wholeheartedly recommend), to track all of my crypto history. That worked great for BTC and Ethereum wallets and most exchanges, however for STEEM (and Bitshares) it was impossible to get a full printout of my transaction history. I did some research and found the steem-report repo by MidnightLightning, but unfortunately it had been broken by recent changes in the Steem API, and I was unable to get it working properly.
That's why I decided to fork that repo and build my own version. That repo can be found here: steem-cointracking.
Instead of fetching data from an API server I decided to use @furion's amazing SteemData service, which allowed me to fetch all the transaction history for a given account. Once I had the data, it was a matter of parsing the various operation types properly and organizing the data, and then writing the data to a CSV file that can be imported directly into CoinTracking.info.
To use the script, simply clone the repo locally then run
npm install. Once the modules are installed, you can run the script for your desired account:
node app.js myaccount
There are some additional input parameters that are explained in the README.
You'll then find a file in the
output folder called
myaccount-steem-transactions.csv. This file can then be imported directly into CoinTracking using their Bulk Imports > CSV Import option:
After weeks of tweaking I now have a working script that generates a mostly correct history, but there are still some discrepancies in balances and some missing data from the Steem blockchain itself.
I've classified block production as Mining, and Author/Curation rewards as Income. You're free to change this however you like, the same goes for any of the many operation types.
I've also added grouping for many operation types, since STEEM generates an enormous amount of transactions. Most groupings are by day, for example author rewards and curation rewards.
If you see a better way of doing things, please open an issue and let me know.
There are issues with the STEEM history for older accounts that participated in the initial mining phase. The producer rewards for that phase are not recorded in the current history, causing missing balances. To compensate for this, I've assigned the difference between the final balance and the actual balance to these early mining operations.
VESTS to STEEM conversion
In order to track the actual value of VESTS, I've added bi-weekly deposits of STEEM that correspond to the current balance of VESTS. This conversion is done using a formula to calculate the steem_per_mvests ratio found here: https://steemit.com/steemdev/@holger80/how-to-estimate-historic-steempermvests-values-for-converting-old-rewards-from-vest-to-steem
I noticed that this formula broke down completely for the early mining phase, so I extracted actual values manually from the blockchain and stored them in a json file. These values were then used to interpolate a better value for early steem_per_mvests ratios.
Despite having spent a lot of time debugging the various operations and tracking down many bugs, there are still accounts where the final calculated balances are different from the actual balances. One of my accounts is a good example,
witness.svk. This account has a large discrepancy in the final balance of MVESTS, and I've so far been unable to track down why. There may be other inaccuracies as well.