In building an IONIC app, I am attempting to retrieve the historical balance of a single Ethereum address. I am currently not sure how far back I will need to go. I know that Etherscan.IO offers a web tool to get balance from a certain date at https://etherscan.io/balancecheck-tool , however I cant find any API's that allow me to do this programmatically. I am also unable to get web3 to install in my current project. Any advise would be appreciated.
I am not talking of the
datafield in the transaction.
Well, you are, actually. The
data field is the input parameters. What you need to know is how to decode them. It's well worth studying the Ethereum ABI if you really want to understand this.
For tools to help, have a look at web3.eth.abi (check you are using v1.0 or higher of Web3). Unfortunately this doesn't do the whole job for you - it could be extended to do so - but it can help.
In your example, your function call will have a signature as follows:
So, if you find a
data field that begins
c47f0027, you know that it is a call to your
setName function and that the remaining data is the string parameter.
In your example, the string data will look like this:
000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000054162636465000000000000000000000000000000000000000000000000000000. This is the ABI string representation of "Abcde").
So you extract this from the
data and feed it into Web3 to decode it as follows:
To summarise your example, the full
data field in the transaction would be "0xc47f0027000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000054162636465000000000000000000000000000000000000000000000000000000".
The first 8 hex characters, "c47f0027" (ignore the 0x if present), mean that this is a call to your
The remaining data is your string parameter and can be decoded using Web3 as above.
These libraries look to automate the above, but I haven't tested them:
First, you go to your address page and click
Erc20 Tokens Txns tab.
Then you look for Aragon in token column and click it.
You will end up on the page where you can export all your transactions in CSV.
And here is your URL structure:
Just add you address as
?a=0x9f7dd5ea934d188a599567ee104e97fa46cb4496 URL parameter to Aragon token URL to get all Aragon transactions for your address.