From 45872d1dcc6b11d5cfc9dbde51e6268c88c01d0d Mon Sep 17 00:00:00 2001 From: osiris account Date: Sat, 11 Mar 2023 21:07:23 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- token-scanner-api/.env.example | 2 +- token-scanner-api/README.md | 49 ++++++++++++++----- token-scanner-api/src/blockchains/ethereum.py | 1 + 3 files changed, 39 insertions(+), 13 deletions(-) diff --git a/token-scanner-api/.env.example b/token-scanner-api/.env.example index d07b36f..db56bb2 100644 --- a/token-scanner-api/.env.example +++ b/token-scanner-api/.env.example @@ -12,7 +12,7 @@ TOKEN_DECIMALS = ######################### MAX_RETRIES = 4 -SIZE_CHUNK_NEXT = 50000 +SIZE_CHUNK_NEXT = 5000 ######################### diff --git a/token-scanner-api/README.md b/token-scanner-api/README.md index f15cb4d..e7c2657 100644 --- a/token-scanner-api/README.md +++ b/token-scanner-api/README.md @@ -1,12 +1,21 @@ -## token scanner api and cli +## πŸ› πŸͺ™ token scanner api and cli +
+ +##### πŸ‘‰ this project implements a cli tool that indexes transfer events for a particular token, and is deployed to a restful api for fast balance and ownership statistics retrieval. this is the first step for training machine learning models on the chains (*e.g.*, high-frequency trading with deep learning). + +##### πŸ“š more details can be found in my mirror post, **[quant #3: building a scalable event scanner for ethereum](https://mirror.xyz/steinkirch.eth/vSF18xcLyfXLIWwxjreRa3I_XskwgnjSc6pScegNJWI)**. + +
+ +--- + +### setting up
#### installing dependencies -create a venv, either using virtualenv, pipenv, or poetry. - because of some of the dependencies in this code, we will be developing on a python3.9 environment (install here if you don’t have that version on disk): ``` @@ -18,9 +27,9 @@ pip3 install -r requirements.txt
-#### add environment variables +#### adding environment variables -now, create an .env file and add an RPC_PROVIDER_URL to connect to ethereum mainnet nodes (you can pick from any of this list of nodes as a service): +create a `.env` file and add an `RPC_PROVIDER_URL` to connect to ethereum mainnet nodes (for example, from [this list](https://ethereumnodes.com/)): ``` cp .env.example .env @@ -33,24 +42,40 @@ vim .env ``` make install -indexer -h ```
-#### deploying on production +---- -we use vercel to deploy this app at . +### running + +
-to deploy new changes, first install vercel: ``` -yarn +indexer -h + + ``` -then run: + +
+ +--- + +### development + +
+ +#### deploying in production + +we use vercel to deploy this app: ``` vercel login vercel . -``` \ No newline at end of file +``` + +
+ diff --git a/token-scanner-api/src/blockchains/ethereum.py b/token-scanner-api/src/blockchains/ethereum.py index 9b12f62..82ecb8f 100644 --- a/token-scanner-api/src/blockchains/ethereum.py +++ b/token-scanner-api/src/blockchains/ethereum.py @@ -117,6 +117,7 @@ class TokenIndexer: def _process_logs(self, logs: list) -> dict: """Process the logs and return a dictionary with the results.""" + log_info(f'Processing {len(logs)} logs...') processed_logs = defaultdict() try: