This repository contains a complex SQL query that utilizes Arbitrary-precision arithmetic to cumulatively sum and subtract 256-bit integers on Ethereum transaction data. The query is designed to calculate the historical token balance of each Ethereum address using PrestoDB.
The Ethereum transaction data required for this query can be obtained using the Ethereum ETL tool, which efficiently extracts blockchain data and stores it in a database for analysis.
The SQL query employs Arbitrary-precision arithmetic to accurately perform cumulative addition and subtraction of 256-bit integers on Ethereum transaction data. By leveraging PrestoDB, it efficiently processes token transfers to calculate the token balance of each Ethereum address at different points in time.
- PrestoDB: The query is designed to run on a PrestoDB cluster or Amazon Athena.
- Ethereum ETL Tool: Users must first use the Ethereum ETL tool to extract and load historical Ethereum transaction data into the PrestoDB database.
To set up the project and run the SQL query, follow these steps:
-
Setup Amazon Athena or connect to an existing PrestoDB cluster.
-
Use the Ethereum ETL tool to extract and load historical Ethereum transaction data into the PrestoDB database.
-
Ensure that the historical Ethereum transaction data is available and up-to-date in the PrestoDB database.
-
Open your PrestoDB client or interface.
-
Copy the contents of the
calculate_historic_balance.sql
file into the query editor. -
Execute the SQL query to calculate the historical token balance of each Ethereum address.