Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Latest commit

 

History

History

token-scanner-api

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

🛠🪙 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. it utilizes JSON-RPC methods eth_blockNumber and eth_getLogs.
🛠 system design for this project:

blockchain intel - mvp

📚 more details can be found in my mirror post, quant #3: building a scalable event scanner for ethereum.


setting up


installing dependencies

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):

virtualenv -p /usr/local/bin/python3.9 venv
source venv/bin/activate
make install_dep

adding environment variables

create a .env file and add an RPC_PROVIDER_URL to connect to ethereum mainnet nodes (for example, from this list):

cp .env.example .env
vim .env

installing the package

make install


running


indexer -h

🪙 Token indexer and API.

optional arguments:
  -h, --help  show this help message and exit
  -e          Retrieve historical transfer events data on Ethereum. Example: indexer -e
  -p PROCESS  Process historical transfer events data. Example: indexer -p <json data file>
  -d DB       Populate db with processed event data. Example: indexer -d <json data file>
  -a          Run the event scanner api locally. Example: indexer -a
  -b BALANCE  Fetch token balance for a given wallet. Example: indexer -b <wallet address>
  -t TOP      Fetch top token holders. Example: indexer -t <number of holders>


deploying in production


follow this instructions to deploy the indexer to vercel and mongodb atlas.