So, taxes for crypto is.. complicated, to put it nicely. There are two main pieces, getting transactions from all the various sources (block chains), and then calculating the cost basis, for actually reporting the taxes. There are a number of systems which handle both fairly well, but all of them miss a source block chains, because there are simply too many, and new block chains come out all the time. Each one with distinct APIs, different terminology, unique capacities and limitations.
The first, and currently only, multi-chain decentralized exchange in crypto is ThorChain. Nothing existed to properly categorize the swapping or depositing of tokens for tax purposes, which is why I made Web3Tax, which is on GitHub. It’s powered by a handful of APIs, and my desire to not have to manually type in all of the thousands of crypto transactions. I’ve run across dozens of block chains that are currently not supported by any of the existing software. The code is open source, but is a little behind changes to some of the upstream API modifications, that I’ve not had time or energy to handle.
On a high level, Web3Tax once a request comes in with a list of wallet addresses, will query a few different APIs, looping to collect each page of data, storing it into a redis cache, until we have all of the data. In addition to the APIs, there is also a “pre-fork” list of transactions of transfers between ThorChain wallets, as no API no longer returns that information. Once we’ve aggregated all the data chronologically, we run through all the transactions to build out a final report.
In order for that final report to integrate with services like Koinly, TaxBit, and CoinTracker, we build out additional transactions to bridge the gap in their understanding of the related block chains. For example a swap from Bitcoin to Ether will involve two transactions, one where Bitcoin is seen leaving your wallet, and a seemingly unrelated transaction on a different block chain a different wallet will receive a different asset. So we have to add the other side of the Bitcoin transaction, then a swap, and finally a outbound transaction to explain the source of the Ether.
Another complexity that has to be carefully accounted for, is depositing and withdrawing liquidity. ThorChain has added complexities beyond your normal liquidity pool. The asset and Rune (the coin of ThorChain) can be deposited on their own, or as a set, and when depositing both any amount of imbalance is permitted. A typical liquidity pool only allows deposits that are 50:50 balanced, and would have a single transaction on a single chain.
We track the amounts deposited and how many liquidity units were awarded, so that we can calculate the gain/loss upon withdrawal. This does however mean, that should a user make multiple deposits, and then make a partial withdraw, the asset and Rune to LP units conversion will be dependant on processing order (first-in-first-out or last-in-first-out). Technically, we could do something like take the average, but that doesn’t really play nicely with tax law.