### Use Rindexer with Existing Project and Docker Compose Source: https://rindexer.xyz/docs/introduction/installation Sets up environment variables for project path and database URL, then starts Rindexer services using Docker Compose. Assumes a running PostgreSQL instance. The GraphQL endpoint will be available at `http://localhost:3001` if enabled. ```bash export PROJECT_PATH=/path/to/your/project export DATABASE_URL="postgresql://user:pass@postgres/db" docker-compose up -d ``` -------------------------------- ### Rindexer CLI Help Command Source: https://rindexer.xyz/docs/introduction/installation Demonstrates how to get help for specific Rindexer CLI commands, such as `rindexer new --help` to get detailed information about the `new` command. ```bash rindexer new --help ``` -------------------------------- ### No-code Project Setup Source: https://rindexer.xyz/docs/start-building/running Instructions for running the no-code Rindexer project using the CLI toolset. This includes automatic PostgreSQL setup via Docker Compose if needed and starting the indexer and GraphQL services. ```APIDOC ## No-code Project Setup You can run the no-code project really easily with the CLI toolset. rindexer starts your postgres docker compose file up for you automatically if the DATABASE_URL can not connect to the database and docker-compose.yml is present in the parent directory. You will need to make sure you have docker running on your machine before starting the project. If you have not got docker you can install it here. You can also run docker manually by using `docker compose up -d`. graphql API can only be ran when you have a postgres storage setup in your YAML. ### Command To start all services: ``` rindexer start all ``` To start only the GraphQL service: ``` rindexer start graphql ``` You can change the GraphQL port by doing `--port [number]` in both `all` and `graphql` commands above. ``` -------------------------------- ### rindexer Project Initialization with Reth Source: https://rindexer.xyz/docs/start-building/create-new-project/reth-mode An example of the interactive prompts and output when creating a new rindexer project with Reth mode enabled. It guides the user through project details, storage options, and Reth-specific configurations. ```bash rindexer new no-code --reth Initializing new rindexer project with Reth support... Project Name: RocketPoolETHIndexer Project Description (skip by pressing Enter): High-performance rETH indexer using Reth Repository (skip by pressing Enter): https://github.com/joshstevens19/rindexer What Storages To Enable? (graphql can only be supported if postgres is enabled) [postgres, csv, both, none]: postgres Postgres Docker Support Out The Box? [yes, no]: yes Reth Configuration: Data Directory (default: ~/.reth): /data/reth Chain (default: mainnet) [mainnet, sepolia, holesky]: mainnet Enable HTTP RPC? [yes, no]: yes Auth RPC Port (default: 8551): 8551 rindexer no-code project created with Reth support with a rETH transfer events YAML template. ``` -------------------------------- ### Start All rindexer Services Source: https://rindexer.xyz/docs/start-building/create-new-project/reth-mode Command to start all configured services for an rindexer project, including the Reth node connection, ExEx setup, and indexing processes. ```bash rindexer start all ``` -------------------------------- ### Start Rindexer All Services Source: https://rindexer.xyz/docs/start-building/running This command starts all Rindexer services, including the indexer and GraphQL API. It automatically manages the PostgreSQL Docker Compose setup if connection fails and Docker is present. The GraphQL port can be customized using the --port flag. ```bash rindexer start all --port [number] ``` -------------------------------- ### Start Rindexer GraphQL API Source: https://rindexer.xyz/docs/start-building/running This command starts only the GraphQL API service for Rindexer. It requires a PostgreSQL storage setup in your YAML configuration. The GraphQL port can be customized using the --port flag. ```bash rindexer start graphql --port [number] ``` -------------------------------- ### Install Rindexer CLI Source: https://rindexer.xyz/docs/introduction/installation Installs the latest version of the Rindexer CLI using a curl script. After installation, you can verify it by running `rindexer --help`. ```bash curl -L https://rindexer.xyz/install.sh | bash ``` ```bash rindexer --help ``` -------------------------------- ### rindexer.yaml Configuration Example Source: https://rindexer.xyz/docs/start-building/create-new-project/standard This is an example of a rindexer.yaml configuration file. It defines project metadata, network settings, storage preferences (PostgreSQL enabled), and contract details including address, ABI path, and events to include. ```yaml name: rETHIndexer description: My first rindexer project repository: https://github.com/joshstevens19/rindexer project_type: no-code networks: - name: ethereum chain_id: 1 rpc: https://mainnet.gateway.tenderly.co storage: postgres: enabled: true contracts: - name: RocketPoolETH details: - network: ethereum address: "0xae78736cd615f374d3085123a210448e74fc6393" start_block: 18600000 end_block: 18718056 abi: ./abis/RocketTokenRETH.abi.json include_events: - Transfer - Approval ``` -------------------------------- ### Full rindexer.yaml Configuration Example Source: https://rindexer.xyz/docs/start-building/yaml-config/global This is a comprehensive example of a rindexer.yaml file, showcasing the definition of project metadata, networks, storage, and a specific contract with its details, ABI, and included events. ```yaml name: rETHIndexer description: My first rindexer project repository: https://github.com/joshstevens19/rindexer project_type: rust networks: - name: ethereum chain_id: 1 rpc: https://mainnet.gateway.tenderly.co storage: postgres: enabled: true contracts: - name: RocketPoolETH details: - network: ethereum address: "0xae78736cd615f374d3085123a210448e74fc6393" start_block: 18900000 end_block: 19000000 abi: ./abis/RocketTokenRETH.abi.json include_events: - Transfer - Approval global: etherscan_api_key: ${ETHERSCAN_API_KEY} ``` -------------------------------- ### Deploy the Helm Chart Source: https://rindexer.xyz/docs/deploying/aws Instructions for deploying Rindexer using its Helm chart, including cloning the repository, configuring values, and installing the chart. ```APIDOC ## Helm Chart Deployment ### Description This section details the steps to deploy the Rindexer application using Helm. It covers cloning the repository, configuring the `values.yaml` file, and installing the Helm chart. ### Steps #### 1. Download the rindexer repository ```bash git clone https://github.com/joshstevens19/rindexer.git ``` #### 2. Configure the `values.yaml` File Customize the `values.yaml` file to match your deployment requirements. Key configurations include replica count, image repository and tag, service type and port, ingress settings, and PostgreSQL enablement. **Example `values.yaml` Configuration:** ```yaml replicaCount: 2 image: repository: ghcr.io/joshstevens19/rindexer tag: "latest" pullPolicy: IfNotPresent service: type: ClusterIP port: 3001 ingress: enabled: false postgresql: enabled: false ``` **Note:** If using AWS RDS with `sslmode=require`, ensure RDS certificates are included in your connection configuration as per AWS RDS SSL documentation. #### 3. Install the Helm Chart Execute the following command to install the Rindexer Helm chart: ```bash helm install rindexer ./helm/rindexer -f helm/rindexer/values.yaml ``` ### Verification #### 1. Verify the Deployment Check the status of the pods to confirm successful deployment: ```bash kubectl get pods ``` **Expected Output:** ``` NAME READY STATUS RESTARTS AGE rindexer-rindexer-94dd58475-p8g5d 1/1 Running 0 17s ``` ``` -------------------------------- ### Create New Rindexer Project with Docker Source: https://rindexer.xyz/docs/introduction/installation Uses a pre-built Docker image to create a new Rindexer 'no-code' project in the current directory. Mounts the current directory to `/app/project_path` within the container. ```bash docker run -it -v $PWD:/app/project_path ghcr.io/joshstevens19/rindexer new -p /app/project_path no-code ``` -------------------------------- ### Rindexer Startup Commands Source: https://rindexer.xyz/docs/start-building/health-monitoring Details on different ways to start the Rindexer service, each with specific use cases and health monitoring availability. ```APIDOC ## Rindexer Startup Commands ### `rindexer start indexer` #### Description Starts the indexer with a long-lived health server for continuous live indexing. #### Use Case Ideal for continuous live indexing that runs indefinitely. #### Health Monitoring Available continuously while the indexer is running. ### `rindexer start graphql` #### Description Starts the GraphQL API without the health server, for GraphQL-only mode. #### Use Case Running only the GraphQL API without indexing. #### Health Monitoring Not available as the health server requires indexing to be enabled. ### `rindexer start all` #### Description Starts both the indexer and the GraphQL API, with a long-lived health server following the GraphQL server's lifecycle. #### Use Case Running both indexing and GraphQL API together. #### Health Monitoring Available as long as the GraphQL server is running. ``` -------------------------------- ### Rust Project Setup Source: https://rindexer.xyz/docs/start-building/running Instructions for running the Rust project, including setting up Docker Compose for PostgreSQL and executing the Cargo build commands for development and production. ```APIDOC ## Rust Project If you want to run this with docker support for the postgres first run: ```bash docker compose up -d ``` Then to run the the rust project you can run the following command: ### Command (Development) ```bash cargo run ``` ### Command (Production Release) We also advise you in production to run your rust projects in release mode, you can run it in release mode using ```bash cargo run --release ``` You can also do other fancy production builds with other frameworks like jemalloc and other flags, but we will leave that to you to explore. ``` -------------------------------- ### Example: Deploying RocketPoolETH Contract Source: https://rindexer.xyz/docs/start-building/phantom An example of deploying the RocketPoolETH phantom contract to the Ethereum network. This demonstrates the practical application of the deploy command. ```bash rindexer phantom deploy --contract-name RocketPoolETH --network ethereum ``` -------------------------------- ### Initialize and Deploy Rindexer Project on Railway Source: https://rindexer.xyz/docs/deploying/railway These commands guide the user through initializing a new Railway project, logging into the Railway CLI, deploying the service, linking it to a project and environment, and adding a PostgreSQL database. It also outlines the steps for configuring essential environment variables like DATABASE_URL and POSTGRES_PASSWORD. ```bash railway login ``` ```bash railway init --name rindexer-example ``` ```bash railway up --detach ``` ```bash railway link ? Select a project > rindexer-example ? Select an environment > production ? Select a service > rindexer-example ``` ```bash railway add --database postgres ``` ```bash railway open ``` ```bash railway domain ``` ```bash railway up ``` -------------------------------- ### Clone Rindexer Repository for Railway Source: https://rindexer.xyz/docs/deploying/railway This command sequence clones the specific Rindexer provider directory for Railway deployments. It uses git sparse-checkout to only download the necessary files, ensuring a clean and efficient setup. ```bash mkdir rindexer-railway && cd rindexer-railway git clone \ --depth=1 \ --no-checkout \ --filter=tree:0 \ https://github.com/joshstevens19/rindexer . git sparse-checkout set --no-cone providers/railway . git checkout && cp -r providers/railway/* . && rm -rf providers ``` -------------------------------- ### Generate GraphQL Queries with Rindexer CLI Source: https://rindexer.xyz/docs/start-building/create-new-project/standard This command-line interface command generates prebuilt GraphQL queries for the Rindexer API, helping developers get started quickly. The generated queries are typically placed in a 'queries' folder. ```bash rindexer codegen graphql ``` -------------------------------- ### Rindexer YAML Configuration Example Source: https://rindexer.xyz/docs/start-building/chatbots/slack An example `rindexer.yaml` configuration file demonstrating how to set up event monitoring for the RocketPoolETH contract on Ethereum. It includes specifying the contract ABI, event filters, and a custom Slack message template that utilizes inline formatting, event variables, and transaction information. ```yaml ... contracts: - name: RocketPoolETH details: - network: ethereum address: "0xae78736cd615f374d3085123a210448e74fc6393" start_block: "18600000" end_block: "18600181" abi: "./abis/RocketTokenRETH.abi.json" include_events: - Transfer chat: slack: - bot_token: ${SLACK_BOT_TOKEN} channel: "#RethTransferEvents" networks: - ethereum messages: - event_name: Transfer template_inline: "*New RETH Transfer Event*\n\n from: {{from}}\n\n to: {{to}}\n\n amount: {{format_value(value, 18)}}\n\n RETH contract: {{transaction_information.address}}\n\n \n " ``` -------------------------------- ### Create New rindexer Project (CLI) Source: https://rindexer.xyz/docs/references/cli Allows the creation of new rindexer projects, supporting both 'no-code' and 'rust' project types. Users are guided through setup via terminal prompts. Optional flags can enable Reth support for high-performance indexing, passing additional arguments to Reth if needed. ```bash Usage: rindexer new [OPTIONS] Commands: no-code Creates a new no-code project rust Creates a new rust project help Print this message or the help of the given subcommand(s) Options: -p, --path optional - The path to create the project in, default will be where the command is run -h, --help Print help (see a summary with '-h') Subcommand Options Both `no-code` and `rust` subcommands support: Options: -r, --reth optional - Enable Reth support for high-performance indexing [-- ...] Additional arguments to pass to reth when --reth is enabled These should be provided after -- e.g. -- --datadir /path --http true Examples: # Standard project rindexer new no-code # Reth-enabled project rindexer new no-code --reth # Reth project with custom arguments rindexer new rust --reth -- --datadir /custom/path --http true ``` -------------------------------- ### Start rindexer Services (CLI) Source: https://rindexer.xyz/docs/references/cli Enables starting various rindexer services, including indexers, GraphQL APIs, or both concurrently. The services are configured based on the `rindexer.yaml` file. A health monitoring server is automatically initiated, with its port configurable in `rindexer.yaml`. ```bash `rindexer start indexer` or `rindexer start graphql` or `rindexer start all` Usage: rindexer start [OPTIONS] Commands: indexer Starts the indexing service based on the rindexer.yaml file graphql Starts the GraphQL server based on the rindexer.yaml file all Starts the indexers and the GraphQL together based on the rindexer.yaml file help Print this message or the help of the given subcommand(s) Options: -p, --path optional - The path to run the command in, default will be where the command is run -h, --help Print help (see a summary with '-h') :::info The health monitoring server runs on port 8080 by default. You can configure it in your `rindexer.yaml` file using the `health_port` setting. See the [Running](/docs/start-building/running#health-monitoring) documentation for more details. ::: ``` -------------------------------- ### Start Rindexer Indexer with Health Server Source: https://rindexer.xyz/docs/start-building/health-monitoring Starts the Rindexer with a long-lived health server that remains active for live indexing. This is suitable for continuous, indefinite indexing operations and provides continuous health monitoring. ```bash rindexer start indexer ``` -------------------------------- ### Start PostgreSQL with Docker Compose Source: https://rindexer.xyz/docs/start-building/running This command is used to start the PostgreSQL database in detached mode using Docker Compose. It's a prerequisite for running the Rust project with Docker support for the database. ```bash docker compose up -d ``` -------------------------------- ### Start Rindexer GraphQL Only (No Health Server) Source: https://rindexer.xyz/docs/start-building/health-monitoring Starts the Rindexer in GraphQL-only mode without initiating a health server. This is used when only the GraphQL API needs to be run, and health monitoring is not available as the health server is not enabled. ```bash rindexer start graphql ``` -------------------------------- ### Install Foundry Source: https://rindexer.xyz/docs/start-building/phantom Installs the Foundry framework, which is required for compiling smart contracts when working with phantom events. It's recommended to install it manually for better control. ```shell curl -L https://foundry.paradigm.xyz | bash ``` -------------------------------- ### Install rindexer Helm Chart Source: https://rindexer.xyz/docs/deploying/gcp This command deploys the rindexer application to your Kubernetes cluster using Helm. It installs the chart from the specified local path and applies configurations from the provided `values.yaml` file. ```bash helm install rindexer ./helm/rindexer -f helm/rindexer/values.yaml ``` -------------------------------- ### Reth Configuration in rindexer.yaml Source: https://rindexer.xyz/docs/start-building/create-new-project/reth-mode Example `rindexer.yaml` file demonstrating how Reth integration is configured. It includes options for enabling Reth, logging, and specifying command-line arguments for the Reth node. ```yaml name: RocketPoolETHIndexer description: High-performance rETH indexer using Reth repository: https://github.com/joshstevens19/rindexer project_type: no-code networks: - name: ethereum chain_id: 1 rpc: https://mainnet.gateway.tenderly.co # Fallback RPC reth: enabled: true logging: true # Show Reth logs in stdout cli_args: - "--datadir /data/reth" - "--http" - "--full false" # Archive mode storage: postgres: enabled: true contracts: - name: RocketPoolETH details: - network: ethereum address: "0xae78736cd615f374d3085123a210448e74fc6393" start_block: 18600000 end_block: 18718056 abi: ./abis/RocketTokenRETH.abi.json include_events: - Transfer - Approval ``` -------------------------------- ### Contract Calls for Indexed Events (Rust) Source: https://rindexer.xyz/docs/start-building/rust-project-deep-dive/indexers Illustrates how to make calls to a contract that is specifically defined for indexing events, such as RocketPoolETH. This example specifies the network when calling the contract function within the handler. ```rust use crate::rindexer_lib::typings::rust::events::rocket_pool_eth::rocket_pool_eth_contract; async fn transfer_handler( manifest_path: &PathBuf, registry: &mut EventCallbackRegistry, ) { RocketPoolETHEventType::Transfer( TransferEvent::handler( |results, context| async move { // have to pass in network name here let rocket_pool_eth = rocket_pool_eth_contract("ethereum"); let name = rocket_pool_eth.name().await; match name { Ok(result) => { println!("rETH name: {:?}", name) return Ok(()); } Err(e) => { println!("Error getting rETH name: {:?}", e) return Err(e.to_string()); } } }, no_extensions(), ) .await, ) .register(manifest_path, registry).await; } ``` -------------------------------- ### Rindexer YAML: Initial Configuration Source: https://rindexer.xyz/docs/start-building/phantom A sample rindexer.yaml file before deploying a phantom contract. It shows basic project setup, networks, and an empty contracts section. ```yaml name: RocketPoolETHIndexer description: My first rindexer project repository: https://github.com/joshstevens19/rindexer project_type: no-code networks: - name: ethereum chain_id: 1 rpc: https://mainnet.gateway.tenderly.co - name: phantom_ethereum_RocketPoolETH chain_id: 1 rpc: PROVIDER_RPC ... ``` -------------------------------- ### Global Contract Calls with Specific Address (Rust) Source: https://rindexer.xyz/docs/start-building/rust-project-deep-dive/indexers Shows how to call a global contract when it has multiple addresses defined in the YAML configuration. This example explicitly passes the desired address to the contract function before making a call. ```rust use crate::rindexer_lib::typings::global_contracts::usdt_contract; async fn transfer_handler( manifest_path: &PathBuf, registry: &mut EventCallbackRegistry, ) { RocketPoolETHEventType::Transfer( TransferEvent::handler( |results, context| async move { let address: Address = "0xdac17f958d2ee523a2206206994597c13d831ec7" .parse() .expect("Invalid address"); let usdt = usdt_contract(address); let name = usdt.name().await; match name { Ok(result) => { println!("USDT name: {:?}", name) return Ok(()); } Err(e) => { println!("Error getting USDT name: {:?}", e) return Err(e.to_string()); } } }, no_extensions(), ) .await, ) .register(manifest_path, registry).await; } ``` -------------------------------- ### Connect to PostgreSQL via PSQL Source: https://rindexer.xyz/docs/accessing-data/direct-sql Connect to your PostgreSQL database using the psql command-line tool. Ensure you have psql installed and replace placeholders with your actual database credentials and connection details. ```bash psql 'postgresql://username:password@localhost:5432/your_database' ``` -------------------------------- ### Main Function for Starting Rindexer Source: https://rindexer.xyz/docs/start-building/rust-project-deep-dive/indexers The `main.rs` file provides boilerplate code to run the Rindexer project. It parses command-line arguments to enable GraphQL and indexing, sets the port, and initializes the `start_rindexer` function with the necessary details, including manifest path and handler registries. ```rust use std::env; use self::rindexer_lib::indexers::all_handlers::register_all_handlers; use rindexer::{ event::callback_registry::TraceCallbackRegistry, start_rindexer, GraphQLServerDetails, GraphQLServerSettings, IndexingDetails, StartDetails, }; mod rindexer_lib; #[tokio::main] async fn main() { let args: Vec = env::args().collect(); let mut enable_graphql = false; let mut enable_indexer = false; let mut port: Option = None; for arg in args.iter() { match arg.as_str() { "--graphql" => enable_graphql = true, "--indexer" => enable_indexer = true, _ if arg.starts_with("--port=") || arg.starts_with("--p") => { if let Some(value) = arg.split('=').nth(1) { let overridden_port = value.parse::(); match overridden_port { Ok(overridden_port) => port = Some(overridden_port), Err(_) => { println!("Invalid port number"); return; } } } } _ => {} } } let path = env::current_dir(); match path { Ok(path) => { let manifest_path = path.join("rindexer.yaml"); let result = start_rindexer(StartDetails { manifest_path: &manifest_path, indexing_details: if enable_indexer { Some(IndexingDetails { registry: register_all_handlers(&manifest_path).await, trace_registry: TraceCallbackRegistry { events: vec![] }, }) } else { None }, graphql_details: GraphqlOverrideSettings { enabled: enable_graphql, override_port: port, }, }) .await; match result { Ok(_) => {} // Success Err(e) => { println!("Error starting rindexer: {:?}", e); } } } Err(e) => { println!("Error getting current directory: {:?}", e); } } } ``` -------------------------------- ### Upgrade and Uninstall Rindexer Source: https://rindexer.xyz/docs/introduction/installation Commands to upgrade Rindexer to the latest version (`rindexerup`) and to uninstall Rindexer (`rindexerdown`). ```bash rindexerup ``` ```bash rindexerdown ``` -------------------------------- ### GET /health Source: https://rindexer.xyz/docs/deploying/railway Retrieves the complete health status of the Rindexer system, including detailed information about various services. ```APIDOC ## GET /health ### Description Retrieves the complete health status of the Rindexer system, including detailed information about various services like database connectivity, indexing status, sync status, and overall system health. ### Method GET ### Endpoint /health ### Parameters None ### Request Example None ### Response #### Success Response (200) - **status** (string) - Overall health status of the system (e.g., "healthy", "unhealthy"). - **timestamp** (string) - The timestamp when the health status was recorded. - **services** (object) - An object containing the health status of individual services. - **database** (string) - Health status of the database service. - **indexing** (string) - Health status of the indexing service. - **sync** (string) - Health status of the synchronization service. - **indexing** (object, optional) - Detailed information about the indexing service if available. - **active_tasks** (integer) - The number of currently active indexing tasks. - **is_running** (boolean) - Indicates if the indexer is currently running. #### Response Example ```json { "status": "healthy", "timestamp": "2024-01-15T10:30:00Z", "services": { "database": "healthy", "indexing": "healthy", "sync": "healthy" }, "indexing": { "active_tasks": 2, "is_running": true } } ``` #### Error Response - **503 Service Unavailable**: Returned when the system has issues. ``` -------------------------------- ### Best Practices Source: https://rindexer.xyz/docs/start-building/health-monitoring Recommended practices for monitoring and maintaining Rindexer in a production environment. ```APIDOC ## Best Practices ### Recommendations - Set up continuous monitoring of the health endpoint. - Configure appropriate alert thresholds. - Keep health check logs for troubleshooting. - Monitor multiple instances if running in a cluster. ``` -------------------------------- ### Initialize New rindexer Project (CLI) Source: https://rindexer.xyz/docs/start-building/create-new-project/standard This command initiates the creation of a new rindexer project. It prompts the user for project details like name, description, repository, and storage configuration (e.g., postgres, csv). ```bash rindexer new no-code ``` -------------------------------- ### Rindexer Health Monitoring Example Response Source: https://rindexer.xyz/docs/deploying/railway This JSON object represents a typical response from the Rindexer health monitoring endpoint. It provides a status overview of key services like the database, indexing, and synchronization components, indicating their operational health. ```json { "status": "healthy", "timestamp": "2024-01-15T10:30:00Z", "services": { "database": "healthy", "indexing": "healthy", "sync": "healthy" }, "indexing": { "active_tasks": 2, "is_running": true } } ``` -------------------------------- ### YAML Configuration for Historic Contract Indexing Source: https://rindexer.xyz/docs/start-building/yaml-config Example of a rindexer YAML configuration for historic data indexing. It specifies a network, storage, and a single contract with defined start and end blocks, along with ABI path and events to include. RPC URL is set to a direct endpoint. ```yaml name: rETHIndexer description: My first rindexer project repository: https://github.com/joshstevens19/rindexer project_type: no-code networks: - name: ethereum chain_id: 1 rpc: https://mainnet.gateway.tenderly.co storage: postgres: enabled: true contracts: - name: RocketPoolETH details: - network: ethereum address: "0xae78736cd615f374d3085123a210448e74fc6393" start_block: 18600000 end_block: 18718056 abi: ./abis/RocketTokenRETH.abi.json include_events: - Transfer - Approval ``` -------------------------------- ### Configure rindexer for AWS SNS Streaming Source: https://rindexer.xyz/docs/start-building/streams/sns Example rindexer YAML configuration to stream contract events to AWS SNS. This setup specifies network details, contract addresses, ABIs, and SNS stream configurations including AWS region, access keys, and topic ARNs. ```yaml name: RocketPoolETHIndexer description: My first rindexer project repository: https://github.com/joshstevens19/rindexer project_type: no-code networks: - name: ethereum chain_id: 1 rpc: https://mainnet.gateway.tenderly.co contracts: - name: RocketPoolETH details: - network: ethereum address: "0xae78736cd615f374d3085123a210448e74fc6393" start_block: "18600000" end_block: "18600181" abi: "./abis/RocketTokenRETH.abi.json" include_events: - Transfer streams: sns: aws_config: region: us-east-1 access_key: ${AWS_ACCESS_KEY_ID} secret_key: ${AWS_SECRET_ACCESS_KEY} # session_token is optional session_token: ${AWS_SESSION_TOKEN} # endpoint_url is optional endpoint_url: ${ENDPOINT_URL} // ![code focus] topics: - topic_arn: "arn:aws:sns:us-east-1:664643779377:test" networks: - ethereum events: - event_name: Transfer alias: RocketPoolTransfer ``` -------------------------------- ### Rindexer Project Configuration Example Source: https://rindexer.xyz/docs/accessing-data/graphql This YAML configuration defines a rindexer project named 'RocketPoolETHIndexer'. It includes project details, network configurations, and contract specifics like addresses, start/end blocks, ABIs, and included events. ```yaml name: RocketPoolETHIndexer description: My first rindexer project repository: https://github.com/joshstevens19/rindexer project_type: no-code networks: - name: ethereum chain_id: 1 rpc: https://mainnet.gateway.tenderly.co storage: postgres: enabled: true contracts: - name: RocketPoolETH details: - network: ethereum address: 0xae78736cd615f374d3085123a210448e74fc6393 start_block: '18600000' end_block: '18718056' abi: ./abis/RocketTokenRETH.abi.json include_events: - Transfer - name: RocketPoolETHFork details: - network: ethereum address: 0xba78736cb615f374d3035123a210448e74fc6392 start_block: '18600000' end_block: '18718056' abi: ./abis/RocketTokenRETH.abi.json include_events: - Transfer ``` -------------------------------- ### rindexer CLI Usage Source: https://rindexer.xyz/docs/references/cli Provides the basic usage and available commands for the rindexer CLI. This includes commands for creating new projects, starting services, adding elements, generating code, and deleting data. It also lists global options like help and version. ```bash Usage: rindexer Commands: new Creates a new rindexer no-code project or rust project start Start various services like indexers, GraphQL APIs or both together add Add elements such as contracts to the rindexer.yaml file codegen Generates rust code based on rindexer.yaml or graphql queries delete Delete data from the postgres database or csv files phantom Use phantom events to add your own events to contracts help Print this message or the help of the given subcommand(s) Options: -h, --help Print help -V, --version Print version ``` -------------------------------- ### Rindexer ABI: Example with Tuple Filtering Source: https://rindexer.xyz/docs/start-building/streams/kafka This ABI snippet illustrates how to filter events based on values within a tuple. The example shows filtering the 'profileId' within the 'quoteParams' tuple for events of type 'QuoteCreated'. ```json { "anonymous": false, "inputs": [ { "components": [ { "internalType": "uint256", "name": "profileId", "type": "uint256" }, ... ], "indexed": false, "internalType": "struct Types.QuoteParams", "name": "quoteParams", "type": "tuple" }, ... ], "name": "QuoteCreated", ... ``` -------------------------------- ### Example Webhook Response for Transfer Event Source: https://rindexer.xyz/docs/start-building/streams/webhooks This JSON object represents an example webhook response for a 'Transfer' event emitted on the Ethereum network. It includes event details, decoded event data, and transaction information. ```json { "event_name": "Transfer", "event_signature_hash": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "event_data": { "from": "0x0338ce5020c447f7e668dc2ef778025ce3982662", "to": "0x0338ce5020c447f7e668dc2ef778025ce3982662", "value": "1000000000000000000", "transaction_information": { "address": "0xae78736cd615f374d3085123a210448e74fc6393", "block_hash": "0x8461da7a1d4b47190a01fa6eae219be40aacffab0dd64af7259b2d404572c3d9", "block_number": "18718011", "log_index": "0", "network": "ethereum", "transaction_hash": "0x145c6705ffbf461e85d08b4a7f5850d6b52a7364d93a057722ca1194034f3ba4", "transaction_index": "0" } }, "network": "ethereum" } ``` -------------------------------- ### Set Start Block for Native Transfers Indexing (YAML) Source: https://rindexer.xyz/docs/start-building/yaml-config/native-transfers Configures the starting block number for indexing native transfers in `rindexer.yaml`. This allows for historical data indexing by specifying a `start_block` within the `native_transfers.networks` configuration. ```yaml name: rIndexer description: My native transfers rindexer project repository: https://github.com/joshstevens19/rindexer project_type: no-code networks: - name: ethereum chain_id: 1 rpc: https://mainnet.gateway.tenderly.co native_transfers: networks: - network: ethereum start_block: 0 contracts: [] ``` -------------------------------- ### Running eRPC with Docker (Bash) Source: https://rindexer.xyz/docs/references/rpc-node-providers Command to run the eRPC Docker image, mounting the configuration file and exposing necessary ports. This command starts eRPC as a standalone service. ```bash docker run -v $(pwd)/erpc.yaml:/root/erpc.yaml -p 4000:4000 -p 4001:4001 ghcr.io/erpc/erpc:latest ``` -------------------------------- ### Configure Rindexer Project with Contract Source: https://rindexer.xyz/docs/start-building/yaml-config/contracts This YAML snippet demonstrates the basic configuration of an Rindexer project, including project details, network settings, storage options, and the initial contract to be indexed. ```yaml name: rETHIndexer description: My first rindexer project repository: https://github.com/joshstevens19/rindexer project_type: no-code networks: - name: ethereum chain_id: 1 rpc: https://mainnet.gateway.tenderly.co storage: postgres: enabled: true contracts: - name: RocketPoolETH ``` -------------------------------- ### Filter Expression Examples for Event Data Source: https://rindexer.xyz/docs/start-building/chatbots/discord This section provides examples of filter expressions used to conditionally send Discord messages based on event data. It covers various data types like numeric, address, string, boolean, and hex string literals, along with supported operators and logical combinations using AND (`&&`), OR (`||`), and parentheses. ```text value > 1000 from = '0x1234567890abcdef1234567890abcdef12345678' name != 'Alice' active = true value >= 1000 && value <= 2000 from = '0x1234567890abcdef1234567890abcdef12345678' || from = '0xabcdefabcdefabcdefabcdefabcdefabcdef' value > 1000 && (from = '0x1234567890abcdef1234567890abcdef12345678' || from = '0xabcdefabcdefabcdefabcdefabcdefabcdef') ``` -------------------------------- ### Generate GraphQL Queries with rindexer Codegen Source: https://rindexer.xyz/docs/start-building/codegen Generate .graphql prebuilt queries for quick setup. These are saved in a 'queries' folder. By default, it targets 'http://localhost:3001/graphql', but the endpoint can be customized using the --endpoint flag. ```bash rindexer codegen graphql rindexer codegen graphql --endpoint=YOUR_GRAPHQL_API_URL ``` -------------------------------- ### Troubleshooting: Common Issues Source: https://rindexer.xyz/docs/start-building/health-monitoring A list of common issues encountered with Rindexer and their potential solutions. ```APIDOC ## Troubleshooting: Common Issues ### Description Provides solutions for frequently encountered problems with Rindexer. ### Common Issues and Solutions - **Health server not starting**: Check if the port is in use and verify your YAML configuration. - **Database health failing**: Verify your PostgreSQL connection and permissions. - **Sync health issues**: Check your storage configuration and file permissions. ``` -------------------------------- ### GET /health Source: https://rindexer.xyz/docs/start-building/health-monitoring Retrieves the complete health status of your Rindexer instance, including individual service statuses and indexing-specific details. ```APIDOC ## GET /health ### Description Returns the complete health status of your rindexer instance. ### Method GET ### Endpoint /health ### Parameters #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **status** (string) - Overall health status of the system ('healthy', 'unhealthy', etc.). - **timestamp** (string) - The timestamp when the health check was performed (ISO 8601 format). - **services** (object) - An object containing the health status of individual services. - **database** (string) - Health status of the database service. - **indexing** (string) - Health status of the indexing service. - **sync** (string) - Health status of the synchronization service. - **indexing** (object, optional) - Details specific to the indexing service if it's enabled and running. - **active_tasks** (integer) - The number of active indexing tasks. - **is_running** (boolean) - Indicates whether the indexer is currently running. #### Response Example ```json { "status": "healthy", "timestamp": "2024-01-15T10:30:00Z", "services": { "database": "healthy", "indexing": "healthy", "sync": "healthy" }, "indexing": { "active_tasks": 2, "is_running": true } } ``` #### Error Response (503 Service Unavailable) Returned when the system has issues and is not healthy. ``` -------------------------------- ### Rindexer Health Monitoring Source: https://rindexer.xyz/docs/deploying/aws Details on Rindexer's built-in health monitoring server, including its endpoints, lifecycle, and status types. ```APIDOC ## Health Monitoring ### Description Rindexer features a built-in health monitoring server that provides real-time insights into system status, including database connectivity, indexing progress, sync status, and overall system health. The health server defaults to port `8080`. ### Health Server Lifecycle The health server's operational state is determined by the services started: - **`rindexer start indexer` (with `end_block` set):** Short-lived; terminates upon completion of historical indexing. - **`rindexer start indexer` (without `end_block` set):** Long-lived; remains active for continuous live indexing. - **`rindexer start graphql`:** No health server is active; health monitoring is unavailable. - **`rindexer start all`:** Long-lived; follows the lifecycle of the GraphQL server. ### Accessing Health Endpoints The health server is automatically initiated when Rindexer is run with indexing enabled. The primary endpoint available is: - **`GET /health`**: Retrieves comprehensive health status with detailed information about each service. **Example Health Response:** ```json { "status": "healthy", "timestamp": "2024-01-15T10:30:00Z", "services": { "database": "healthy", "indexing": "healthy", "sync": "healthy" }, "indexing": { "active_tasks": 2, "is_running": true } } ``` ### Health Status Types The `/health` endpoint can return the following status types for services: - **`healthy`**: The service is functioning normally. - **`unhealthy`**: The service has encountered an error. - **`unknown`**: The status of the service cannot be determined. - **`not_configured`**: The service is not set up or configured. - **`disabled`**: The service is intentionally deactivated. - **`no_data`**: The service is operational but currently has no data. - **`stopped`**: The service is not currently running. ### Service Health Checks - **Database Health Check:** - **`healthy`**: PostgreSQL is enabled, and a simple `SELECT 1` query executes successfully. - **`unhealthy`**: PostgreSQL is enabled, but connection attempts fail, or query errors occur. - **`not_configured`**: PostgreSQL is enabled, but no database client is available. - **`disabled`**: PostgreSQL is not enabled in the configuration. - **Indexing Health Check:** - **`healthy`**: The indexer is actively running (indicated by a set system state flag). - **`stopped`**: The indexer is not running (indicated by an unset system state flag). - **Sync Health Check:** - Checks data synchronization status for PostgreSQL and CSV storage. - **`healthy`**: Data synchronization is functioning correctly. - **`no_data`**: No data tables or files exist yet, which is acceptable for new deployments. - **`unhealthy`**: Errors detected in the synchronization process. - **`disabled`**: Synchronization is not configured. ``` -------------------------------- ### Example Kafka Configuration in rindexer YAML Source: https://rindexer.xyz/docs/start-building/streams/kafka This YAML snippet demonstrates how to configure Kafka for rindexer, specifying brokers, acknowledgment settings, security protocol, and event topics. It allows for custom routing keys and network-specific event streams. ```yaml name: RocketPoolETHIndexer description: My first rindexer project repository: https://github.com/joshstevens19/rindexer project_type: no-code networks: - name: ethereum chain_id: 1 rpc: https://mainnet.gateway.tenderly.co contracts: - name: RocketPoolETH details: - network: ethereum address: "0xae78736cd615f374d3085123a210448e74fc6393" start_block: "18600000" end_block: "18600181" abi: "./abis/RocketTokenRETH.abi.json" include_events: - Transfer streams: kafka: brokers: - ${KAFKA_BROKER_URL_1} - ${KAFKA_BROKER_URL_2} acks: all security_protocol: PLAINTEXT topics: - topic: test-topic # key is optional key: my-routing-key networks: - ethereum events: - event_name: Transfer alias: RocketPoolTransfer ``` -------------------------------- ### Enable Debug Logging for Rindexer Health Server Source: https://rindexer.xyz/docs/start-building/health-monitoring Demonstrates how to enable debug logging for the Rindexer health server using the `RUST_LOG` environment variable. This is useful for troubleshooting and gaining detailed insights into the health server's operations. ```bash RUST_LOG=debug rindexer start indexer ``` -------------------------------- ### Enable PostgreSQL Storage in Rindexer YAML Source: https://rindexer.xyz/docs/start-building/yaml-config/storage Example YAML configuration to enable PostgreSQL as the storage provider for Rindexer. Sets the 'enabled' flag to true. ```yaml name: RETHIndexer description: My first rindexer project repository: https://github.com/joshstevens19/rindexer project_type: no-code networks: - name: ethereum chain_id: 1 rpc: https://mainnet.gateway.tenderly.co storage: postgres: enabled: true ```