{"id":47936648,"url":"https://github.com/tangle-network/subsquid-portal-blueprint","last_synced_at":"2026-04-04T07:44:32.501Z","repository":{"id":343619251,"uuid":"962921879","full_name":"tangle-network/subsquid-portal-blueprint","owner":"tangle-network","description":"A Tangle Blueprint for running a Subsquid Portal","archived":false,"fork":false,"pushed_at":"2025-10-09T14:26:32.000Z","size":263,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-04T07:44:30.361Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tangle-network.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-08T22:05:26.000Z","updated_at":"2025-04-08T22:07:15.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tangle-network/subsquid-portal-blueprint","commit_stats":null,"previous_names":["tangle-network/subsquid-portal-blueprint"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tangle-network/subsquid-portal-blueprint","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fsubsquid-portal-blueprint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fsubsquid-portal-blueprint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fsubsquid-portal-blueprint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fsubsquid-portal-blueprint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tangle-network","download_url":"https://codeload.github.com/tangle-network/subsquid-portal-blueprint/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fsubsquid-portal-blueprint/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31392186,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T04:26:24.776Z","status":"ssl_error","status_checked_at":"2026-04-04T04:23:34.147Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-04-04T07:44:31.826Z","updated_at":"2026-04-04T07:44:32.485Z","avatar_url":"https://github.com/tangle-network.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Subsquid Portal Tangle Blueprint\n\nThis blueprint enables Tangle Network operators to provide managed Subsquid Portal instances with an optional authenticated and rate-limited gateway service.\n\n## Overview\n\nSubsquid Portals provide efficient access to blockchain data via the Subsquid Network. This blueprint allows operators to run these portals as a service for customers who need reliable data access without managing the infrastructure themselves.\n\nKey features:\n\n- **Portal Provisioning:** Operators can easily deploy new `sqd-portal` instances configured for specific networks (e.g., `mainnet`).\n- **Authenticated Gateway:** An optional gateway can be configured to sit in front of a portal instance, requiring API keys for access.\n- **Rate Limiting:** The gateway enforces configurable rate limits per API key.\n- **API Key Management:** Customers (or operators on their behalf) can generate new API keys associated with a specific gateway, with the key securely delivered via RSA encryption.\n\n## Users \u0026 Interactions\n\n1.  **Operator:**\n\n    - Deploys this blueprint service on the Tangle Network.\n    - Registers their service instance.\n    - Manages the underlying infrastructure (Docker, host machine).\n    - Can call any job on behalf of customers if needed.\n\n2.  **Customer (Requester):**\n\n    - Requests a portal instance from an operator (off-chain agreement).\n    - Provides necessary configuration (network, RPC URLs, etc.) to the operator.\n    - Requests gateway configuration (desired port) from the operator.\n    - Requests API key generation, providing their RSA public key for secure delivery.\n    - Uses the provided API key (after decrypting it) to access data through the operator's gateway endpoint.\n    - Likely pays the operator off-chain or via a separate smart contract mechanism for the service.\n\n3.  **Tangle Network:**\n    - Facilitates job submission and result delivery.\n    - Provides the secure execution environment for the blueprint.\n\n## Jobs\n\nThis blueprint exposes the following jobs callable via the Tangle Network:\n\n1.  **`provision_portal` (ID: 1)**\n\n    - **Action:** Deploys a new `sqd-portal` Docker container based on the standard `subsquid/sqd-portal` image and the provided `subsquid-docker-compose.yml`.\n    - **Arguments:**\n      - `network`: (String) e.g., \"tethys\" or \"mainnet\".\n      - `key_path_on_host`: (String) Absolute path _on the operator's machine_ to the portal's network key file.\n      - `rpc_url`: (String) Primary blockchain RPC endpoint URL.\n      - `l1_rpc_url`: (Optional\u003cString\u003e) L1 RPC endpoint URL (if applicable).\n      - `boot_nodes`: (Optional\u003cList\u003cString\u003e\u003e) List of boot nodes in \"\u003cpeer_id\u003e \u003caddress\u003e\" format.\n    - **Returns:** (String) Success message with the new Docker container ID.\n    - **Called by:** Operator (usually based on a customer request).\n\n2.  **`configure_gateway` (ID: 2)**\n\n    - **Action:** Configures and starts (or restarts) the authenticated gateway proxy for a specific portal instance. Aborts any existing gateway task for that instance.\n    - **Arguments:**\n      - `portal_container_id`: (String) The container ID returned by `provision_portal`.\n      - `listen_port`: (u16) The TCP port the gateway should listen on (e.g., 8090).\n    - **Returns:** (String) Success message confirming configuration.\n    - **Called by:** Operator (based on customer request to enable gateway).\n\n3.  **`generate_api_key` (ID: 3)**\n    - **Action:** Generates a new, secure API key for an existing, configured gateway, associates an optional rate limit, and adds it to the gateway's configuration.\n    - **Arguments:**\n      - `portal_container_id`: (String) The container ID of the portal whose gateway needs the key.\n      - `limit_per_sec`: (Optional\u003cu32\u003e) Requests per second limit for this key (0 or None for unlimited).\n      - `public_key`: (Vec\u003cu8\u003e) The requester's RSA public key (PKCS#1 DER format) used to encrypt the new API key.\n    - **Returns:** (String) The new API key, RSA encrypted and base64 encoded.\n    - **Called by:** Customer (or Operator). _Note: Payment verification might be added via a smart contract proxy._\n\n## Setup \u0026 Running\n\n1.  **Prerequisites:**\n    - Rust toolchain\n    - Docker\n    - Access to a Tangle RPC endpoint\n    - A funded Tangle account with keys\n2.  **Build:**\n    ```bash\n    cargo build --release\n    ```\n3.  **Configure Environment:**\n    - Set up environment variables for the Tangle connection, keystore, service ID, etc., typically via a `.env` file loaded by the `BlueprintEnvironment`.\n4.  **Run:**\n    ```bash\n    ./target/release/subsquid-portal-blueprint-bin\n    ```\n\n## Development\n\n- **Library Crate:** `subsquid-portal-blueprint-lib` contains the core logic, context, jobs, and gateway implementation.\n- **Binary Crate:** `subsquid-portal-blueprint-bin` sets up the `BlueprintRunner`, router, producer, consumer, and context, then starts the blueprint service.\n- **Tests:** E2E tests are located in `subsquid-portal-blueprint-lib/tests/e2e.rs` (requires Docker).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftangle-network%2Fsubsquid-portal-blueprint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftangle-network%2Fsubsquid-portal-blueprint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftangle-network%2Fsubsquid-portal-blueprint/lists"}