Skip to content

Latest commit

 

History

History
158 lines (106 loc) · 4.01 KB

README.md

File metadata and controls

158 lines (106 loc) · 4.01 KB

Envio Hyperindexer Blueprint 🌐

An Envio Hyperindexer-as-a-Service Blueprint for Tangle

📚 Overview

A Tangle Blueprint for managing multiple Envio indexers through job execution. This blueprint enables automated deployment and management of Envio indexers through Tangle's job system.

🎯 Features

  • Spawn multiple Envio indexers per instance
  • Manage indexers through Tangle jobs

💡 Usage

The blueprint exposes jobs that can be called through Tangle's job system. All configurations are passed as serialized bytes.

Spawn an Indexer

// Example job call (from your application)
let config = IndexerConfig {
    name: "uniswap_v3",
    contracts: vec![
        ContractConfig {
            name: "UniswapV3Pool",
            address: "0x...",
            events: vec![...]
            abi: "..."
        }
    ]
};

let params = serde_json::to_vec(&SpawnIndexerParams { config })?;
let result = call_job(0, params).await?; // Returns indexer ID

📚 Prerequisites

Before you can run this project, you will need to have the following software installed on your machine:

You will also need to install cargo-tangle, our CLI tool for creating and deploying Tangle Blueprints:

To install the Tangle CLI, run the following command:

Supported on Linux, MacOS, and Windows (WSL2)

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/tangle-network/gadget/releases/download/cargo-tangle-v0.1.2/cargo-tangle-installer.sh | sh

Or, if you prefer to install the CLI from crates.io:

cargo install cargo-tangle --force # to get the latest version.

🧪 Testing

Prerequisites

Before running tests, ensure you have the following installed:

Setting up the Test Environment

  1. Create a local Kubernetes cluster using Kind:
kind create cluster --name test-cluster
  1. Create the test namespace:
kubectl create namespace test-namespaces
  1. Set up a local Docker registry:
docker run -d -p 5000:5000 --name registry registry:2
  1. Connect the registry to Kind network
docker network connect kind registry

Running Tests

The test suite includes both unit tests and integration tests that interact with the local Kubernetes cluster. Run them with:

cargo test

Key test files:

  • src/kubernetes/deployment.rs: Tests for Kubernetes deployment management
  • src/lib.rs: Integration tests for indexer spawning
  • src/envio.rs: Tests for Envio project lifecycle

The tests verify:

  • Deployment configuration building
  • Service configuration building
  • Local indexer spawning
  • Kubernetes indexer deployment
  • Envio project lifecycle management

Reference implementation:

Cleanup

  1. Delete the Kind cluster
kind delete cluster --name test-cluster
  1. Remove the local Docker registry
docker rm -f registry

📜 License

at your option.

📬 Feedback and Contributions

We welcome feedback and contributions to improve this blueprint. Please open an issue or submit a pull request on our GitHub repository.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.