FatStx / FatStx.github.io

FatStx Site
8 stars 2 forks source link

Integration with Crypto Tax Calculator #23

Closed timbrunette closed 1 month ago

timbrunette commented 6 months ago

We are looking at adding Stacks as a data source into CTC (https://cryptotaxcalculator.io/) and would like to work with the team here to see if we can get a relevant format supported for upload into our software.

egtalbot commented 6 months ago

Hi Tim - At this point I'm kind of just keeping FatStx in maintenance mode and not adding new features. You can take a look at the csv export function and I suspect it has all the fields you would need, just might not be exactly how you would like them. If you need one or two columns added, that's something I would consider doing.

However, it probably would overall be more appropriate anyway for CTC to use the Hiro/Leather Api. This pull directly from the blockchain, whereas FatStx pulls from the Hiro/Leather Api so it's an extra layer of abstraction.

The main challenge with Hiro/Leather api is you can only get 50 transactions at a time and you can't specify dates, just blockheights or specific groups of transactions (e.g. records 750-800 of 5000). So you wind up writing loops, and you have to put in pauses or you get errors for too many requests. If you have to go back three years on a wallet with 10,000 transactions, it can take a while. But given the nature of tax software, that probably is okay. Here's the reference for the hiro Api: https://docs.hiro.so/api/introduction

and here's a sample call: https://api.mainnet.hiro.so/extended/v1/address/SP8A9HZ3PKST0S42VM9523Z9NV42SZ026V4K39WH.ccd002-treasury-mia-mining-v2/transactions_with_transfers?limit=50&unanchored=false&offset=0

The above call is what I use and I believe it brings back everything you would need for taxes. But definitely dive into the api documentation on your own and do some experiments with actual wallets to ensure nothing important is missed by that call.

There used to be a site called Stacks on chain which ran Stacks nodes and pulled all transactions into a database. You could write basic queries for free, and for a monthly fee you could have very robust access. This might have been ideal for your needs but as near as I can tell the site doesn't exist any more - it did a year ago.

timbrunette commented 1 month ago

Thanks @egtalbot for the detailed response ⚡