Compute the fair market value (FMV) of staking rewards at time of receipt.

Overview

tendermint-tax

A tool to help calculate the tax liability of staking rewards on Tendermint chains.

Specifically, this tool calculates the fair market value (FMV) of staking rewards at time of receipt - that is, the time that you claimed the reward. It does the same for other inflows and outflows of tokens, like sending tokens to a friend.

WARNING

This software might not work

THIS IS A WORK IN PROGRESS. This is experimental software. No one else has looked at it yet. Use at your own risk.

And even if it does work...

This a tool I use to help my CPA. This is not tax advice. I am not a CPA. Use at your own risk. You have been warned.

Install

# clone this repo
git clone [email protected]:elsehow/tendermint-tax
cd tendermint-tax
# create a python virtual machine
python3 -m venv venv
source venv/bin/activate
# install the dependences
pip3 install -r requirements.txt

Use

This command will get the FMV at time of reciept for the address juno175q6smvgnuec5e62rs4chnu5cs8d98q2xgf4rx for financial year Jan 1, 2021 - Dec 31, 2021, saving the resulting file as juno.csv:

# make sure virtual machine is active
source venv/bin/activate
# run tendermint-tax
python3 tendermint-tax.py --rpc  https://rpc-juno.itastakers.com --address juno175q6smvgnuec5e62rs4chnu5cs8d98q2xgf4rx --ticker JUNO --fystart "2021-01-01" --fyend "2021-12-31" --outfile "juno.csv" -v

See detailed help on all arguments with python3 tendermint-tax.py --help.

Did this tool help you?

Did this tool save you time or money? Delegate with me!

Stake with me:

  • Juno - elsehow junovaloper175q6smvgnuec5e62rs4chnu5cs8d98q2e4l6cl
  • Stargaze - elsehow starsvaloper1hvw778wslvyxh6mmv3sy96mwnaw80elmrswc6h
  • Oasis - Daylight Network oasis1qra3rvq7y055waxmnx8rc0nad3frr8na2s9l8l3f

Or pay what you think is fair:

  • Cosmos - cosmos175q6smvgnuec5e62rs4chnu5cs8d98q2s62wy6
  • Osmosis - osmo175q6smvgnuec5e62rs4chnu5cs8d98q2cpe7jg
  • Akash - akash175q6smvgnuec5e62rs4chnu5cs8d98q2ap8faq
  • Regen - regen175q6smvgnuec5e62rs4chnu5cs8d98q20cpjj7

License

BSD-3

Comments
  • Suggest to loosen the dependency on funcy

    Suggest to loosen the dependency on funcy

    Hi, your project tendermint-tax(commit id: e5e5a81161132e51b6f1a70845c17bd3a10cd424) requires "funcy==1.17" in its dependency. After analyzing the source code, we found that the following versions of funcy can also be suitable, i.e., funcy 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, since all functions that you directly (1 APIs: funcy.seqs.flatten) or indirectly (propagate to 0 funcy's internal APIs and 0 outsider APIs) used from the package have not been changed in these versions, thus not affecting your usage.

    Therefore, we believe that it is quite safe to loose your dependency on funcy from "funcy==1.17" to "funcy>=1.11,<=1.17". This will improve the applicability of tendermint-tax and reduce the possibility of any further dependency conflict with other projects.

    May I pull a request to further loosen the dependency on funcy?

    By the way, could you please tell us whether such an automatic tool for dependency analysis may be potentially helpful for maintaining dependencies easier during your development?

    opened by Agnes-U 2
  • Akash address issue

    Akash address issue

    (venv) ➜ tendermint-tax git:(main) ✗ python3 tendermint-tax.py --chain akash --address [akashaddress] --ticker AKT --fystart "2021-01-01" --fyend "2021-12-31" --outfile "akash.csv" -v 2022-02-28 14:50:02 INFO: Querying RPC for transfer.recipient='[akashaddress]' Traceback (most recent call last): File "/Users/zinc-ops/Documents/GitHub/tendermint-tax/venv/lib/python3.9/site-packages/urllib3/connection.py", line 158, in _new_conn conn = connection.create_connection( File "/Users/zinc-ops/Documents/GitHub/tendermint-tax/venv/lib/python3.9/site-packages/urllib3/util/connection.py", line 80, in create_connection raise err File "/Users/zinc-ops/Documents/GitHub/tendermint-tax/venv/lib/python3.9/site-packages/urllib3/util/connection.py", line 70, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 61] Connection refused

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "/Users/zinc-ops/Documents/GitHub/tendermint-tax/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 597, in urlopen httplib_response = self._make_request(conn, method, url, File "/Users/zinc-ops/Documents/GitHub/tendermint-tax/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 354, in _make_request conn.request(method, url, **httplib_request_kw) File "/usr/local/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1285, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/local/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1331, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/local/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1280, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/local/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1040, in _send_output self.send(msg) File "/usr/local/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 980, in send self.connect() File "/Users/zinc-ops/Documents/GitHub/tendermint-tax/venv/lib/python3.9/site-packages/urllib3/connection.py", line 181, in connect conn = self._new_conn() File "/Users/zinc-ops/Documents/GitHub/tendermint-tax/venv/lib/python3.9/site-packages/urllib3/connection.py", line 167, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x11bb5e610>: Failed to establish a new connection: [Errno 61] Connection refused

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "/Users/zinc-ops/Documents/GitHub/tendermint-tax/venv/lib/python3.9/site-packages/requests/adapters.py", line 440, in send resp = conn.urlopen( File "/Users/zinc-ops/Documents/GitHub/tendermint-tax/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 637, in urlopen retries = retries.increment(method, url, error=e, _pool=self, File "/Users/zinc-ops/Documents/GitHub/tendermint-tax/venv/lib/python3.9/site-packages/urllib3/util/retry.py", line 399, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='135.181.60.250', port=26657): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x11bb5e610>: Failed to establish a new connection: [Errno 61] Connection refused'))

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "/Users/zinc-ops/Documents/GitHub/tendermint-tax/tendermint-tax.py", line 60, in txs = util.historical_txs(rpc, query) File "/Users/zinc-ops/Documents/GitHub/tendermint-tax/lib/util.py", line 51, in historical_txs res = tx_search(rpc, query, per_page=str(per_page)) File "/Users/zinc-ops/Documents/GitHub/tendermint-tax/lib/util.py", line 43, in tx_search resp = post(rpc, json=q) File "/Users/zinc-ops/Documents/GitHub/tendermint-tax/venv/lib/python3.9/site-packages/requests/api.py", line 117, in post return request('post', url, data=data, json=json, **kwargs) File "/Users/zinc-ops/Documents/GitHub/tendermint-tax/venv/lib/python3.9/site-packages/requests/api.py", line 61, in request return session.request(method=method, url=url, **kwargs) File "/Users/zinc-ops/Documents/GitHub/tendermint-tax/venv/lib/python3.9/site-packages/requests/sessions.py", line 529, in request resp = self.send(prep, **send_kwargs) File "/Users/zinc-ops/Documents/GitHub/tendermint-tax/venv/lib/python3.9/site-packages/requests/sessions.py", line 645, in send r = adapter.send(request, **kwargs) File "/Users/zinc-ops/Documents/GitHub/tendermint-tax/venv/lib/python3.9/site-packages/requests/adapters.py", line 519, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='135.181.60.250', port=26657): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x11bb5e610>: Failed to establish a new connection: [Errno 61] Connection refused'))

    opened by pmorrow90 1
  • Example given in the README fails

    Example given in the README fails

    $ python tendermint-tax.py --rpc  https://rpc-juno.itastakers.com --address juno175q6smvgnuec5e62rs4chnu5cs8d98q2xgf4rx --ticker JUNO --fystart "2021-01-01" --fyend "2021-12-31" --outfile "juno.csv" -v
    2022-01-07 13:33:38 INFO: Querying RPC for transfer.recipient='juno175q6smvgnuec5e62rs4chnu5cs8d98q2xgf4rx'
    2022-01-07 13:33:41 INFO: Computing inflows and outflows for juno175q6smvgnuec5e62rs4chnu5cs8d98q2xgf4rx
    Traceback (most recent call last):
      File "/home/x/build/tendermint-tax/tendermint-tax.py", line 53, in <module>
        inflows, outflows = util.inflows_outflows(txs, args.address)
      File "/home/x/build/tendermint-tax/lib/util.py", line 145, in inflows_outflows
        inflow = extract_inflow_staking_rewards(es) + extract_inflow_staking_commission(es) + extract_inflow_transfer(es, my_address) #+ extract_inflow_spends(es, my_address)
      File "/home/x/build/tendermint-tax/lib/util.py", line 119, in extract_inflow_transfer
        return extract_transfer(events, 'transfer', 'recipient', my_address)
      File "/home/x/build/tendermint-tax/lib/util.py", line 113, in extract_transfer
        v = udenom_to_int(v)
      File "/home/x/build/tendermint-tax/lib/util.py", line 76, in udenom_to_int
        return int(udenom.split('u')[0])
    ValueError: invalid literal for int() with base 10: '630713615ibc/008BFD000A10BCE5F0D4DD819AE1C1EC2942396062DABDD6AE64A655ABC7085B'
    
    opened by lachesis 1
  • Merge Error for cosmoshub chain

    Merge Error for cosmoshub chain

    Getting the following error

    (venv) ➜ tendermint-tax git:(main) ✗ python3 tendermint-tax.py --chain cosmoshub --address [cosmoshubaddress] --ticker ATOM --fystart "2021-01-01" --fyend "2021-12-31" --outfile "cosmos.csv" -v 2022-02-28 14:40:41 INFO: Querying RPC for transfer.recipient='[cosmoshubaddress]' 2022-02-28 14:40:42 INFO: Computing inflows and outflows for [cosmoshubaddress] 2022-02-28 14:40:42 INFO: Querying RPC for the UTC time of each relevant block height 2022-02-28 14:40:42 INFO: Querying historical pricing data on ATOM 2022-02-28 14:40:48 INFO: Computing historical fair market value (FMV) for ATOM 2022-02-28 14:40:48 INFO: Aligning blocks with historical pricing data Traceback (most recent call last): File "/Users/zinc-ops/Documents/GitHub/tendermint-tax/tendermint-tax.py", line 101, in merged_df = pd.merge_asof(inflow_outflow_df, fmvs_df, on='time', direction='nearest') File "/Users/zinc-ops/Documents/GitHub/tendermint-tax/venv/lib/python3.9/site-packages/pandas/core/reshape/merge.py", line 580, in merge_asof op = _AsOfMerge( File "/Users/zinc-ops/Documents/GitHub/tendermint-tax/venv/lib/python3.9/site-packages/pandas/core/reshape/merge.py", line 1740, in init _OrderedMerge.init( File "/Users/zinc-ops/Documents/GitHub/tendermint-tax/venv/lib/python3.9/site-packages/pandas/core/reshape/merge.py", line 1623, in init _MergeOperation.init( File "/Users/zinc-ops/Documents/GitHub/tendermint-tax/venv/lib/python3.9/site-packages/pandas/core/reshape/merge.py", line 699, in init ) = self._get_merge_keys() File "/Users/zinc-ops/Documents/GitHub/tendermint-tax/venv/lib/python3.9/site-packages/pandas/core/reshape/merge.py", line 1858, in _get_merge_keys raise MergeError(msg) pandas.errors.MergeError: incompatible merge keys [0] dtype('<M8[ns]') and datetime64[ns, UTC], must be the same type

    opened by pmorrow90 1
  • Script is giving me a completely empty csv

    Script is giving me a completely empty csv

    Ran script on address, gave me an empty CSV

    ➜ tendermint-tax git:(main) source venv/bin/activate

    (venv) ➜ tendermint-tax git:(main) python3 tendermint-tax.py --chain juno --address [junoaddress] --ticker JUNO --fystart "2021-01-01" --fyend "2021-12-31" --outfile "juno.csv" -v 2022-02-28 14:29:09 INFO: Querying RPC for transfer.recipient='[junoaddress]' 2022-02-28 14:29:11 INFO: Computing inflows and outflows for [junoaddress] 2022-02-28 14:29:11 INFO: Querying RPC for the UTC time of each relevant block height 2022-02-28 14:29:36 INFO: Querying historical pricing data on JUNO 2022-02-28 14:29:49 INFO: Computing historical fair market value (FMV) for JUNO 2022-02-28 14:29:49 INFO: Aligning blocks with historical pricing data 2022-02-28 14:29:50 INFO: For the FY, computing FMV at time of receipt 2022-02-28 14:29:50 INFO: Computed net liability as $0.0 2022-02-28 14:29:50 INFO: Writing CSV to juno.csv (venv) ➜ tendermint-tax git:(main) ✗

    opened by pmorrow90 1
  • Improve the way we get UTC times from block heights

    Improve the way we get UTC times from block heights

    opened by elsehow 0
  • Implement `--fiat` flag

    Implement `--fiat` flag

    Currently, we only find FMV valuations in USD. We could support more currencies.

    I would recommend doing this by finding historical conversions between USD and the fiat in question. This is the most robust solution, as these conversion rates invariably exist. We would align them to the historical Osmosis market data to produce an FMV in the target fiat.

    enhancement 
    opened by elsehow 0
  • Identify airdops, stakedrops

    Identify airdops, stakedrops

    Currently, we can't tell what your balance is at network genesis.

    We should get historical balances to identify stakedrops.

    See this gist for how to use the RPC to do gRPC stuff - not sure if it will work for our purposes, though.

    enhancement 
    opened by elsehow 0
Owner
null
A simple API that will return a key-value pair of randomly generated UUID

A simple API that will return a key-value pair of randomly generated UUID. Key will be a timestamp and value will be UUID. While the server is running, whenever the API is called, it should return all the previous UUIDs ever generated by the API alongside a new UUID.

Pius Lucky 2 Jan 18, 2022
Edit SRT files to delay subtitle time-stamps.

subtitle-delay A program written in Python that directly edits SRT file to delay the subtitles. Features: Will throw an error if delaying with negativ

null 8 Jul 17, 2022
Python implementation of Gorilla time series compression

Gorilla Time Series Compression This is an implementation (with some adaptations) of the compression algorithm described in section 4.1 (Time series c

Ghiles Meddour 19 Jan 1, 2023
Simple integer-valued time series bit packing

Smahat allows to encode a sequence of integer values using a fixed (for all values) number of bits but minimal with regards to the data range. For example: for a series of boolean values only one bit is needed, for a series of integer percentages 7 bits are needed, etc.

Ghiles Meddour 7 Aug 27, 2021
Conveniently measures the time of your loops, contexts and functions.

Conveniently measures the time of your loops, contexts and functions.

Maciej J Mikulski 79 Nov 15, 2022
A time table app to notify the user about their class timings

kivyTimeTable A time table app to notify the user about their class timings Features This project incorporates some features i wanted to see in a time

null 2 Dec 15, 2021
ticktock is a minimalist library to view Python time performance of Python code.

ticktock is a minimalist library to view Python time performance of Python code.

Victor Benichoux 30 Sep 28, 2022
Gradually automate your procedures, one step at a time

Gradualist Gradually automate your procedures, one step at a time Inspired by https://blog.danslimmon.com/2019/07/15/ Features Main Features Converts

Ross Jacobs 8 Jul 24, 2022
New time-based UUID formats which are suited for use as a database key

uuid6 New time-based UUID formats which are suited for use as a database key. This module extends immutable UUID objects (the UUID class) with the fun

null 26 Dec 30, 2022
UUID version 7, which are time-sortable (following the Peabody RFC4122 draft)

uuid7 - time-sortable UUIDs This module implements the version 7 UUIDs, proposed by Peabody and Davis in https://www.ietf.org/id/draft-peabody-dispatc

Steve Simmons 22 Dec 20, 2022
FAIR Enough Metrics is an API for various FAIR Metrics Tests, written in python

☑️ FAIR Enough metrics for research FAIR Enough Metrics is an API for various FAIR Metrics Tests, written in python, conforming to the specifications

Maastricht University IDS 3 Jul 6, 2022
fair-test is a library to build and deploy FAIR metrics tests APIs supporting the specifications used by the FAIRMetrics working group.

☑️ FAIR test fair-test is a library to build and deploy FAIR metrics tests APIs supporting the specifications used by the FAIRMetrics working group. I

Maastricht University IDS 6 Oct 30, 2022
This is simply code for bitcoin fair value.

About The Project This is a code for bitcoin fair value, its simply exclude bubble data using RANSAC method, and then plot the results. Check youtube

BitcoinRaven 4 Mar 26, 2022
A pairs trade is a market neutral trading strategy enabling traders to profit from virtually any market conditions.

A pairs trade is a market neutral trading strategy enabling traders to profit from virtually any market conditions. This strategy is categorized as a statistical arbitrage and convergence trading strategy.

Kanupriya Anand 13 Nov 27, 2022
Tools for use in DeFi. Impermanent Loss calculations, staking and farming strategies, coingecko and pancakeswap API queries, liquidity pools and more

DeFi open source tools Get Started Instalation General Tools Impermanent Loss, simple calculation Compare Buy & Hold with Staking and Farming Complete

Juan Pablo Pisano 467 Jan 8, 2023
An application to see if your Ethereum staking validator(s) are members of the current or next post-Altair sync committees.

eth_sync_committee.py Since the Altair upgrade, 512 validators are randomly chosen every 256 epochs (~27 hours) to form a sync committee. Validators i

null 4 Oct 27, 2022
In this repo i inherit the pos module and added QR code to pos receipt

odoo-pos-inherit In this repo i inherit the pos module and added QR code to pos receipt 1- Create new Odoo Module using command line $ python odoo-bin

null 5 Apr 9, 2022
Log4j-Scanner with Bind-Receipt and custom hostnames

Hrafna - Log4j-Scanner for the masses Features Scanning-system designed to check your own infra for vulnerable log4j-installations start and stop scan

null 18 Jan 23, 2022
A Discord bot that rewards players in Minecraft for sending messages on Discord

MCRewards-Discord-Bot A Discord bot that rewards players in Minecraft for sending messages on Discord How to setup: Download this git as a .zip, or cl

null 3 Dec 26, 2021
A python script based on opencv and paddleocr, which can automatically pick up tasks, make cookies, and receive rewards in the Destiny 2 Dawning Oven

A python script based on opencv and paddleocr, which can automatically pick up tasks, make cookies, and receive rewards in the Destiny 2 Dawning Oven

null 1 Dec 22, 2021