[script] Recording Keeping For Tax Purposes

Discussion in 'Proof-of-stake Mining' started by fhirschmann, Jan 4, 2018.

Tags:
  1. 2017/12/15 - Decred v1.1.2 released! → Release Notes  → Downloads
  1. fhirschmann

    fhirschmann New Member

    Apr 15, 2017
    2
    1
    Male
    Germany
    Hello,

    I'm trying to write a script that reproduces the totalsubsidy field in dcrctl --wallet getstakeinfo on a per vote basis. Specifically, I'm interested in the individual points in time when voting subsidy was received.

    I have always been using a PoS mining pool and I'm looking up my ticket address in the Insight blockchain explorer. I'm then summing up all subsidies as follows:

    Code:
    #!/usr/bin/env python
    import requests
    
    url = "https://mainnet.decred.org/api/txs/?address=D..."
    r = requests.get(url).json()
    txs = r["txs"]
    
    vins = []
    
    for tx in sorted(txs, key=lambda tx: tx["time"]):
        if not tx.get("isStakeGen", False):
            continue
            
        for vin in tx["vin"]:
            if vin.get("isStakeBase", False):
                vins.append(vin)
    
    sum(vins)
    
    
    However, using the above code I end up with a much lower number compared to totalsubsidy. Am I missing an important part of the voting process?

    Thanks
     
  2. fhirschmann

    fhirschmann New Member

    Apr 15, 2017
    2
    1
    Male
    Germany
    Please consider this as solved. I simply forgot I was once mining on another stake pool. I will post the complete code that also includes the mempool fee in the next days for anyone interested.
     
    skillfulhacking likes this.
  3. jet

    jet New Member

    Jan 29, 2017
    67
    9
    Web
    Getting data from the local dcrd instance would be much faster and private (no exposing of your address to the web), but in any case this is useful. I suggest posting to GitHub when ready, for easier collaboration.
     

Share This Page