{"id":15292415,"url":"https://github.com/bce99/usdt-contract-indexer","last_synced_at":"2026-01-03T21:05:42.608Z","repository":{"id":256237598,"uuid":"853740157","full_name":"bce99/USDT-Contract-Indexer","owner":"bce99","description":"🎛️A Python-based indexer for tracking USDT transactions, deployed on AWS EC2 with real-time metrics via Prometheus and visualized on Grafana. Features a custom dashboard and alerts for significant transactions.","archived":false,"fork":false,"pushed_at":"2024-09-09T16:26:59.000Z","size":1617,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T19:13:43.194Z","etag":null,"topics":["aws-ec2","devops","grafana-cloud","grafana-dashboard","openmetrics","prometheus","prometheus-exporter","smart-contract","terraform"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bce99.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-07T12:03:02.000Z","updated_at":"2024-09-11T10:20:00.000Z","dependencies_parsed_at":"2024-09-09T19:47:25.382Z","dependency_job_id":"301d9733-48a8-466a-9b42-5a3875fccb7f","html_url":"https://github.com/bce99/USDT-Contract-Indexer","commit_stats":null,"previous_names":["bce99/automata-devops-assignment"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bce99/USDT-Contract-Indexer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bce99%2FUSDT-Contract-Indexer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bce99%2FUSDT-Contract-Indexer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bce99%2FUSDT-Contract-Indexer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bce99%2FUSDT-Contract-Indexer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bce99","download_url":"https://codeload.github.com/bce99/USDT-Contract-Indexer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bce99%2FUSDT-Contract-Indexer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267057292,"owners_count":24028810,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-25T02:00:09.625Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-ec2","devops","grafana-cloud","grafana-dashboard","openmetrics","prometheus","prometheus-exporter","smart-contract","terraform"],"created_at":"2024-09-30T16:17:46.839Z","updated_at":"2026-01-03T21:05:42.574Z","avatar_url":"https://github.com/bce99.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# USDT-Contract-Indexer\n\n## Overview\n\nThis project involves developing and deploying an ERC20 smart contract indexer application on an AWS EC2 instance that integrates with Prometheus for metrics collection and Grafana for visualization. The application tracks USDT transactions and other relevant data. To verify if certain step is fulfill, you can refer to screenshots in ```/contract-indexer/screenshots```.\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Features](#features)\n- [Setup](#setup)\n- [Deployment](#deployment)\n- [Usage](#usage)\n- [Metrics](#metrics)\n- [Alerting](#alerting)\n- [Troubleshooting](#troubleshooting)\n- [License](#license)\n\n## Features\n\n- Indexer application to track USDT transactions and approvals.\n- Prometheus for collecting metrics.\n- Grafana for visualizing metrics and creating dashboards.\n- Alerts for significant token transfers.\n\n## Setup\n\n### Prerequisites\n\n- Docker\n- Prometheus\n- Grafana Cloud account\n- Terraform\n\n### Installation\n\n1. **Clone the repository:**\n\n    ```sh\n    git clone https://github.com/yourusername/your-repo.git\n    cd your-repo\n    ```\n    \n2. **Install Terraform:**\n\n    Follow the instructions [here](https://www.terraform.io/downloads.html) to install Terraform.\n\n3. **Initialize Terraform \u0026 Apply Terraform Plan:**\n\n    Change the configurations in '/contract-indexer/terraform_setup/main.tf' to match your AWS details.\n    Run the following command in the root of your Terraform directory:\n\n    ```sh\n    terraform init\n    terraform apply\n    ```\n\n    This will provision an EC2 instance, set up the necessary networking, and install Docker. To ssh into your EC2 instance, follow [this](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connect-linux-inst-ssh.html) guide\n    \n4. **Verify Deployment:**\n\n    After the Terraform plan is applied, verify that the EC2 instance is running and that Docker is installed.\n    \n5. **Download Prometheus**\n\n    To download Prometheus into your EC2 instance, run the following commands:\n   \n    ```sh\n    wget https://github.com/prometheus/prometheus/releases/download/v2.36.0/prometheus-2.36.0.linux-amd64.tar.gz\n    tar xvf prometheus-2.36.0.linux-amd64.tar.gz\n    cd prometheus-2.36.0.linux-amd64\n    ```\n    \n7. **Configure prometheus.yml and run Prometheus:**\n\n    You should first create a free account on [Grafana Cloud](https://grafana.com/products/cloud/) and request for your own authentication details.\n    Then fill in the 'remote-write' section and replace the two 'targets' parameter with indexer and node-exporter container IP respectively, using the following commands:\n   \n    ```sh\n    docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' my-indexer-container\n    docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' node-exporter\n    ```\n\n    Run Prometheus detached mode:\n\n    ```sh\n    nohup ./prometheus --config.file=prometheus.yml \u003e prometheus.log 2\u003e\u00261 \u0026\n    ```\n\n    You are now good to connect your data source on Grafana Cloud and establish dashboards!\n   \n## Usage\n\n- **Access Prometheus:**\n  \n  Open your browser and go to `http://\u003cEC2-PUBLIC-IP\u003e:9090/targets?search=`.\n\n  You can expect something like this:\n  \n  ![http://\u003cEC2-PUBLIC-IP\u003e:9090/targets?search=](/contract-indexer/screenshots/9090-targets.png)\n\n- **Access all metrics on node-exporter:**\n  \n  Open your browser and go to `http://\u003cEC2-PUBLIC-IP\u003e:9100`.\n\n  You can expect something like this:\n  \n  ![http://\u003cEC2-PUBLIC-IP\u003e:9100](/contract-indexer/screenshots/9100.png)\n\n- **Access indexer output:**\n  \n  Open your browser and go to `http://\u003cEC2-PUBLIC-IP\u003e:9200`.\n\n  You can expect something like this:\n  \n  ![http://\u003cEC2-PUBLIC-IP\u003e:9200](/contract-indexer/screenshots/9200.png)\n\n- **Final Dashboard:**\n  \n  You should see something like this!\n\n  ![final-dashboard](/contract-indexer/screenshots/grafana-dashboard-token_transferred_per_second.png)\n\n## Metrics\n\n- **`tx_per_second`**: Shows the rate of transactions per second.\n- **`token_transferred_per_second`**: Shows the rate of tokens transferred per second.\n- **`approvals_per_second`**: Shows the rate of approvals per second.\n- **`approval_amount_metric`**: Shows the rate of tokens approved per second.\n\n## Alerting\n\n1. **Create an alert rule in Grafana Cloud:**\n\n    Set up an alert to trigger when the rate of token transfers exceeds a threshold.\n\n    - **Metric:** `token_transferred_per_second`\n    - **Condition:** Is above a certain value (e.g., 100 tokens)\n\n## Troubleshooting\n\n- **Issue:** No data in Grafana dashboard.\n  \n  **Solution:** Verify that the indexer container is running and exposing metrics on port 9200.\n\n- **Issue:** Prometheus target is down.\n  \n  **Solution:** Ensure that Prometheus can access the indexer container on the specified port.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbce99%2Fusdt-contract-indexer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbce99%2Fusdt-contract-indexer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbce99%2Fusdt-contract-indexer/lists"}