Search code examples
pythonjsonjson-rpcsolana

Solana Determine Date and Time of Inflation Reward Distribution by Epoch


Is there any way to determine the exact date and time that corresponds to when inflation rewards were distributed for a given epoch? For example, the following:

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getInflationReward",
    "params": [
      [my_staking_address], {"epoch": epoch}
    ]
  }

returns:

{'jsonrpc': '2.0', 'result': [{'amount': 15711280, 'commission': 0, 'effectiveSlot': 103680000, 'epoch': 239, 'postBalance': 4799957221}], 'id': 1}

but there is no date and time associated with when the inflation reward was distributed. I need this information for tax purposes since I need to determine the price of SOL at the time the staking reward was received.

Given only the epoch, how can I determine the exact date and time of when the staking reward was received?


Solution

  • The effectiveSlot from that return is going to help you more, since you can use that with getBlockTime to get the timestamp for when that slot was processed: https://docs.solana.com/developing/clients/jsonrpc-api#getblocktime