Tax Reporting for Ethereum mining
It is tax season again. By April 18, millions of Americans need to submit their tax returns. And as a permanent resident in my new country, I need to do the same. The difference is that this year it will be even more fun, as I did some Ethereum mining.
My mining activities have created income for me, and so it is no surprise that the IRS wants to collect taxes on it. Notice 2014-21 contains a lot of detail on how the IRS looks at virtual currencies. In the case of mining, it explains that this needs to be reported as income. But how do you determine the income you generated?
There’s a great site at bitcoin.tax that can help you determine your mining income. The site allows you to put in your mining addresses, after which it will download the associated mining transactions from the blockchain, match them with the price of Ethereum at the transaction time, and add everything up. The result is a report with your total mining income. This process also gives you a cost basis for your coins, so that if you ever sell them again in the future (a separate taxable event), you can calculate your gains.
But, what fun is just using the bitcoin.tax site if we can write a small script that does the same thing? So I wrote a Python script that does exactly that, which you can download here.
The script requires the requests and pytz modules, so install those if you don’t have them. You may want to set up a virtual environment, and you also need to make sure that you do that with Python3.
Use the script as follows:
Running the script on my mining account (obfuscating some details for obvious reasons):
Some features of the script:
-
It downloads transaction data using the etherscan.io public API. The API is nice and you only need one call to get all transactions for a single account.
-
It downloads bulk pricing data once, from etherchain.org, and then uses that to price all transactions. Earlier versions were using a different API to price a single transaction, but this turned out to be very slow.
-
The script tells you the average and maximum “staleness” of the pricing data that is used. The etherchain pricing usually has a granularity of one hour.
-
It saves the transaction and pricing data to a JSON file. This allows you to reconstruct the mining revenue you calculated at any time in the future (maybe you get audited).
The output of the run above is a CSV file with all transactions, that can be imported into a spreadsheet for further processing. I imported it into Google Sheets, and added two things:
-
A type column, where I tag mining transactions as “mining”. In my case mining transactions are easily identified as they are all for little over 1 ether, and come from just 3 different pool addresses.
-
A call to SUMIF to calculate the total revenue from all the tagged mining transactions.
As a last step I compared my results to those I got from bitcoin.tax. The difference was less than 3 dollars, likely caused by using slightly different pricing data. So I’m pretty confident that the results are correct.
That’s it for this post folks. Hope it was useful!