2

I'm trying to get wallet contents as a specific historical block - using the below approach. I've found how to get the data for a specific token from the documentation, but is there a way to get list of all tokens in the wallet at that time?

from web3 import Web3
import pandas as pd

my_provider = Web3.HTTPProvider('http://node ip') w3 = Web3(my_provider)

token_address = '0x6B175474E89094C44Da98b954EedeAC495271d0F' #DAI dai_ABI = 'some abi code' contract = w3.eth.contract(token_address, abi=dai_ABI) w = 'wallet' raw_balance = contract.functions.balanceOf(w).call(block_identifier=14000000)

1 Answers1

2

You need to connect to a node that runs in an archive mode. Because running archive node is expensive, it is quite rare. You can do run a node yourself if you have several terabytes of disk space. There are some commercial node provides, but expect to pay for this service.

A list of Ethereum node providers.

Mikko Ohtamaa
  • 22,269
  • 6
  • 62
  • 127