{"id":47936618,"url":"https://github.com/tangle-network/blockchain-rpc-blueprint","last_synced_at":"2026-04-04T07:44:30.416Z","repository":{"id":289718473,"uuid":"972176612","full_name":"tangle-network/blockchain-rpc-blueprint","owner":"tangle-network","description":"A Tangle Blueprint for running various blockchain RPCs","archived":false,"fork":false,"pushed_at":"2025-04-27T18:30:02.000Z","size":411,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-04T07:44:27.892Z","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}},"created_at":"2025-04-24T16:48:51.000Z","updated_at":"2025-04-27T18:28:57.000Z","dependencies_parsed_at":"2025-04-24T18:39:36.187Z","dependency_job_id":null,"html_url":"https://github.com/tangle-network/blockchain-rpc-blueprint","commit_stats":null,"previous_names":["tangle-network/blockchain-rpc-blueprint"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tangle-network/blockchain-rpc-blueprint","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fblockchain-rpc-blueprint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fblockchain-rpc-blueprint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fblockchain-rpc-blueprint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fblockchain-rpc-blueprint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tangle-network","download_url":"https://codeload.github.com/tangle-network/blockchain-rpc-blueprint/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fblockchain-rpc-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:29.657Z","updated_at":"2026-04-04T07:44:30.402Z","avatar_url":"https://github.com/tangle-network.png","language":"Rust","readme":"# Blockchain RPC Blueprint: Secure RPC Gateway\n\nThis Tangle Blueprint provides a secure gateway for accessing arbitrary blockchain RPC nodes. It acts as a proxy layer that enforces access control rules defined and managed through Tangle jobs.\n\n## ✨ Features\n\n- **RPC Proxy:** Forwards HTTP and WebSocket JSON-RPC requests to a configured backend node (e.g., Substrate, Ethereum, Polkadot).\n- **Firewall:** Controls access based on IP address/CIDR ranges and Account IDs.\n- **Job-Based Access Control:**\n  - Grant permanent access to specific IPs or Accounts (`allow_access` job).\n  - Allow users to gain temporary access, potentially linked to payments (`pay_for_access` job - payment verification needs implementation).\n- **Webhook Notifications:** Sends notifications about firewall events (access granted/denied, rules added, etc.) to configured webhook URLs.\n- **Configurable:** Define backend RPC URL, listener address, firewall rules, and webhooks via a simple `config.toml` file.\n- **Persistent Service:** Runs as a continuous background service alongside the Tangle job processing logic.\n\n## 🔧 Configuration (`config.toml`)\n\nThe blueprint requires a `config.toml` file located in the blueprint's configuration directory (determined by the `BlueprintEnvironment` when deployed).\n\n```toml\n# Example configuration for the Secure RPC Gateway Blueprint\n\n[rpc]\n# Address and port the gateway listens on (HTTP and WebSocket)\nlisten_addr = \"0.0.0.0:8545\"\n\n# URL of the backend RPC node to proxy requests to.\n# Use http/ws for unencrypted, https/wss for encrypted backends.\n# Example: proxy_to_url = \"http://localhost:9933\" # Local Substrate node\n# Example: proxy_to_url = \"wss://rpc.polkadot.io\"\n# Example: proxy_to_url = \"http://localhost:8545\" # Local Ethereum node (geth/reth)\nproxy_to_url = \"http://localhost:9933\"\n\n# Maximum allowed request body size in bytes (e.g., for large batch requests)\nmax_body_size_bytes = 10485760 # 10 MB\n\n# Timeout for proxied requests in seconds\nrequest_timeout_secs = 30\n\n[firewall]\n# Set to true to disable all IP/Account checks (USE WITH CAUTION!)\nallow_unrestricted_access = false\n\n# List of static IP addresses or CIDR ranges allowed permanent access.\n# Useful for whitelisting specific frontends (like PolkadotJS apps) or admin IPs.\nallow_ips = [\n    \"127.0.0.1\",\n    \"::1\",\n    # \"192.168.1.0/24\", # Example CIDR\n    # Add IPs used by common explorers/apps if desired\n]\n\n# List of static AccountId32 addresses allowed permanent access.\n# These accounts bypass IP checks if identified (e.g., via future token auth).\nallow_accounts = [\n    # \"5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY\", # Example Polkadot address\n]\n\n[webhooks]\n# List of URLs to send event notifications to (e.g., access granted/denied, rules added).\n# Events are sent as POST requests with JSON payloads.\nevent_urls = [\n    # \"https://my-monitoring-service.com/webhook/rpc-gateway\"\n]\n```\n\nSee `config.toml` in the repository root for a template.\n\n## 🏗️ Build\n\n```bash\ncargo build --release -p blockchain-rpc-bin\n```\n\nThe binary will be located at `./target/release/secure-rpc-gateway`.\n\n## ▶️ Run\n\n1.  **Ensure Backend RPC is Running:** Make sure the blockchain node specified in `proxy_to_url` (in your `config.toml`) is running and accessible.\n2.  **Set Up Configuration:** Place your `config.toml` file in the directory the blueprint expects (this depends on your deployment environment setup, often `./data/config/config.toml` relative to where the blueprint runs).\n3.  **Run the Binary:**\n    ```bash\n    ./target/release/secure-rpc-gateway\n    ```\n    The gateway will start listening on the `listen_addr` and connect to the Tangle network to process jobs.\n\n## 🛠️ Jobs\n\nInteract with the running blueprint by submitting jobs to the Tangle network associated with its Service ID.\n\n- **`ALLOW_ACCESS_JOB_ID` (0):** Grant permanent access.\n  - **Input Type:** `AllowAccessInput { target: AccessTarget }`\n  - `AccessTarget::Ip(String)`: IP address or CIDR range (e.g., \"192.168.1.10\", \"10.0.0.0/16\").\n  - `AccessTarget::Account(String)`: AccountId32 address string.\n  - _Note: This job should ideally be restricted to admin callers._\n- **`PAY_FOR_ACCESS_JOB_ID` (1):** Grant temporary access to the _caller_.\n  - **Input Type:** `PayForAccessInput { duration_secs: u64 }`\n  - _Note: Payment verification logic needs to be implemented within the job handler based on your specific requirements (e.g., checking token transfers, EVM events)._\n- **`REGISTER_WEBHOOK_JOB_ID` (2):** Register a new webhook URL.\n  - **Input Type:** `RegisterWebhookInput { url: String }`\n  - URL must use `http` or `https` scheme.\n\nRefer to the types defined in `blockchain-rpc-lib/src/jobs/` for exact input structures and serialization details.\n\n## 📜 License\n\nThis project is licensed under either of\n\n- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or \u003chttp://opensource.org/licenses/MIT\u003e)\n\nat your option.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftangle-network%2Fblockchain-rpc-blueprint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftangle-network%2Fblockchain-rpc-blueprint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftangle-network%2Fblockchain-rpc-blueprint/lists"}