diff --git a/manager/config.yml b/manager/config.yml index 28f92a3..6147456 100644 --- a/manager/config.yml +++ b/manager/config.yml @@ -1,45 +1,104 @@ +# ============================================================================ +# INTERX MANAGER CONFIGURATION +# ============================================================================ +# Source: manager/internal/service.go, manager/gateway/factory.go +# ============================================================================ + +# Common server settings (sai-service framework pattern) common: http: - enabled: true - port: 8080 + enabled: true # Enable HTTP server + port: 8080 # HTTP port (used for API + P2P health checks) ws: - enabled: false - port: 8881 + enabled: false # Enable WebSocket server + port: 8881 # WebSocket port +# Service version for compatibility checks version: "v0.15.0" +# ---------------------------------------------------------------------------- +# STORAGE SERVICE (sai-storage-mongo) +# Used by: StorageGateway +# ---------------------------------------------------------------------------- storage: - token: "" - url: "http://storage.local:8880" + token: "" # Auth token for storage service + url: "http://storage.local:8880" # Storage service URL + # retries: 1 # Retry attempts for failed requests (default: 1) + # retry_delay: 10 # Delay between retries in seconds (default: 10) + # rate_limit: 10 # Requests per second limit (default: 10) + +# ---------------------------------------------------------------------------- +# ETHEREUM GATEWAY +# Used by: EthereumGateway for EVM chain interactions +# ---------------------------------------------------------------------------- ethereum: - interaction: "http://ethereum-interaction.local:8882" - nodes: + interaction: "http://ethereum-interaction.local:8882" # ethereum-contract-interaction service URL + nodes: # Map of chain_id -> RPC endpoint chain1: "https://data-seed-prebsc-1-s1.bnbchain.org:8545" - token: "" - retries: 1 - retry_delay: 10 - rate_limit: 100000 + # mainnet: "https://eth-mainnet.example.com" + # polygon: "https://polygon-rpc.example.com" + token: "" # Auth token for interaction service + retries: 1 # Retry attempts (default: 1) + retry_delay: 10 # Retry delay in seconds (default: 10) + rate_limit: 100000 # Requests/sec limit (high = disabled) + +# ---------------------------------------------------------------------------- +# COSMOS/KIRA GATEWAY (SEKAI) +# Used by: CosmosGateway +# Struct: manager/types/cosmos.go:364-382 +# ---------------------------------------------------------------------------- cosmos: node: - json_rpc: "sekai.local:9090" - tendermint: "http://sekai.local:26657" - tx_modes: - sync: true - async: true - block: true - gw_timeout: 30 - interaction: "http://cosmos-interaction.local:8884" - token: "" - retries: 1 - retry_delay: 10 - rate_limit: 2 + json_rpc: "sekai.local:9090" # gRPC endpoint (no protocol prefix) + tendermint: "http://sekai.local:26657" # Tendermint RPC (with http://) + tx_modes: # Transaction broadcast modes + sync: true # Returns after CheckTx (fast) + async: true # Returns immediately (fastest) + block: true # Returns after block inclusion (slowest, safest) + gw_timeout: 30 # HTTP client timeout in seconds + interaction: "http://cosmos-interaction.local:8884" # cosmos-interaction service URL + token: "" # Auth token for interaction service + retries: 1 # Retry attempts + retry_delay: 10 # Retry delay in seconds + rate_limit: 2 # Requests/sec (low for public nodes) + # faucet: # Optional faucet configuration + # faucet_amounts: # Tokens to dispense per claim + # ukex: 100000000 + # faucet_minimum_amounts: # Max balance to be eligible + # ukex: 1000000 + # fee_amounts: # Tx fee by denom + # ukex: 100 + # time_limit: 86400 # Seconds between claims + +# ---------------------------------------------------------------------------- +# BITCOIN GATEWAY (optional, uncomment if needed) +# Used by: BitcoinGateway +# ---------------------------------------------------------------------------- +# bitcoin: +# url: "" # Bitcoin RPC URL (http://user:pass@host:port) +# retries: 1 +# retry_delay: 10 +# rate_limit: 10 +# ---------------------------------------------------------------------------- +# P2P NETWORK +# Used by: manager/internal/service.go:33-44 +# Struct: manager/p2p/config/config.go +# ---------------------------------------------------------------------------- p2p: - id: "1" - address: "127.0.0.1:9000" - peers: [] - max_peers: 2 + id: "1" # Unique node ID in P2P network + address: "127.0.0.1:9000" # P2P listen address (host:port) + peers: [] # Initial peer addresses to connect + # peers: + # - "192.168.1.10:9000" + # - "192.168.1.11:9000" + max_peers: 2 # Max peer connections (default: 3, code default: 10) +# ---------------------------------------------------------------------------- +# LOAD BALANCER +# Struct: manager/p2p/config/config.go:19-26 +# Hardcoded weights: CPU=0.3, Memory=0.3, RPS=0.2, Latency=0.2 +# ---------------------------------------------------------------------------- balancer: - window_size: 60 - threshold: 0.2 + window_size: 60 # Metrics averaging window in seconds + threshold: 0.2 # Load difference threshold for rebalancing diff --git a/proxy/config.yml b/proxy/config.yml index c3f9789..6dd7870 100644 --- a/proxy/config.yml +++ b/proxy/config.yml @@ -1,10 +1,21 @@ +# ============================================================================ +# INTERX PROXY CONFIGURATION +# ============================================================================ +# Simple reverse proxy that forwards requests to the Manager service. +# Source: proxy/internal/service.go +# ============================================================================ + +# Common server settings (sai-service framework pattern) common: http: - enabled: false - port: 8080 + enabled: false # Enable HTTP server (proxy uses custom listener) + port: 8080 # HTTP port (default: 80 in code) ws: - enabled: false - port: 8881 + enabled: false # Enable WebSocket server + port: 8881 # WebSocket port +# ---------------------------------------------------------------------------- +# MANAGER CONNECTION +# ---------------------------------------------------------------------------- manager: - url: http://manager.local:8080 + url: http://manager.local:8080 # URL of the Manager service to proxy to diff --git a/worker/cosmos/sai-cosmos-indexer/config.yml b/worker/cosmos/sai-cosmos-indexer/config.yml index 0ae0e88..3642655 100644 --- a/worker/cosmos/sai-cosmos-indexer/config.yml +++ b/worker/cosmos/sai-cosmos-indexer/config.yml @@ -1,25 +1,46 @@ +# ============================================================================ +# COSMOS INDEXER CONFIGURATION +# ============================================================================ +# Indexes Cosmos/SEKAI blockchain data into MongoDB storage. +# Source: worker/cosmos/sai-cosmos-indexer/internal/service.go +# ============================================================================ + +# Common server settings (sai-service framework pattern) common: http: - enabled: true - port: 8883 + enabled: true # Enable HTTP server for health checks/API + port: 8883 # HTTP port ws: - enabled: false - port: 8081 + enabled: false # Enable WebSocket server + port: 8081 # WebSocket port +# ---------------------------------------------------------------------------- +# STORAGE SERVICE (sai-storage-mongo) +# ---------------------------------------------------------------------------- storage: - token: "" - url: "http://storage.local:8880" - email: "" - password: "" - mongo_collection_name: "cosmos" + token: "" # Auth token for storage service + url: "http://storage.local:8880" # Storage service URL + email: "" # Email for auth (alternative to token) + password: "" # Password for auth (alternative to token) + mongo_collection_name: "cosmos" # MongoDB collection name for indexed data + +# ---------------------------------------------------------------------------- +# NOTIFIER SERVICE (optional alerts/notifications) +# ---------------------------------------------------------------------------- notifier: - token: "lafijsiadnm/a@@#lsa$fd8f" - url: "http://localhost:8885" - sender_id: "Cosmos" + token: "lafijsiadnm/a@@#lsa$fd8f" # Auth token for notifier + url: "http://localhost:8885" # Notifier service URL + sender_id: "Cosmos" # Identifier for notification source + email: "" # Email for auth (alternative to token) + password: "" # Password for auth (alternative to token) -node_address: "http://sekai.local:26657" -start_block: 1 -tx_type: "" -sleep_duration: 2 -handle_blocks: true -skip_faile_tx: false \ No newline at end of file +# ---------------------------------------------------------------------------- +# INDEXER SETTINGS +# ---------------------------------------------------------------------------- +node_address: "http://sekai.local:26657" # Tendermint RPC endpoint to index from +start_block: 1 # Block height to start indexing from (0 = latest) +tx_type: "" # Filter by tx type (empty = all types) +sleep_duration: 2 # Seconds to wait between polling for new blocks +handle_blocks: true # Index block data (not just transactions) +skip_failed_tx: false # Skip failed transactions (code expects this name) +# NOTE: Original config had typo "skip_faile_tx" - use "skip_failed_tx" diff --git a/worker/cosmos/sai-cosmos-interaction/config.yml b/worker/cosmos/sai-cosmos-interaction/config.yml index 3ee9dd5..2bc11fe 100644 --- a/worker/cosmos/sai-cosmos-interaction/config.yml +++ b/worker/cosmos/sai-cosmos-interaction/config.yml @@ -1,8 +1,21 @@ +# ============================================================================ +# COSMOS INTERACTION SERVICE CONFIGURATION +# ============================================================================ +# Handles Cosmos/SEKAI blockchain interactions (tx signing, queries). +# Source: worker/cosmos/sai-cosmos-interaction/internal/handlers.go +# ============================================================================ + +# Common server settings (sai-service framework pattern) common: http: - enabled: true - port: 8884 + enabled: true # Enable HTTP server + port: 8884 # HTTP port for API endpoints ws: - enabled: false - port: 8081 + enabled: false # Enable WebSocket server + port: 8081 # WebSocket port + +# ---------------------------------------------------------------------------- +# AUTHENTICATION +# ---------------------------------------------------------------------------- +# Token used to authenticate incoming requests from Manager service token: "a@@#lsa$fd8f" diff --git a/worker/ethereum/sai-ethereum-contract-interaction/config.yml b/worker/ethereum/sai-ethereum-contract-interaction/config.yml index 287b931..c64464a 100644 --- a/worker/ethereum/sai-ethereum-contract-interaction/config.yml +++ b/worker/ethereum/sai-ethereum-contract-interaction/config.yml @@ -1,14 +1,50 @@ +# ============================================================================ +# ETHEREUM CONTRACT INTERACTION SERVICE CONFIGURATION +# ============================================================================ +# HTTP proxy for creating transactions to Ethereum/EVM contracts. +# Source: worker/ethereum/sai-ethereum-contract-interaction/internal/handlers.go +# Note: Contracts are defined separately in contracts.json +# ============================================================================ + +# Common server settings (sai-service framework pattern) common: http: - enabled: true - port: 8882 + enabled: true # Enable HTTP server + port: 8882 # HTTP port for API endpoints socket: - enabled: false - port: 9000 + enabled: false # Enable socket server + port: 9000 # Socket port ws: - enabled: false - port: 9001 - log_mode: "debug" + enabled: false # Enable WebSocket server + port: 9001 # WebSocket port + log_mode: "debug" # Log level: debug, info, warn, error + +# ---------------------------------------------------------------------------- +# AUTHENTICATION +# ---------------------------------------------------------------------------- +# Token used to authenticate incoming requests from Manager service token: "a@@#lsa$fd8f" + +# ---------------------------------------------------------------------------- +# ETHEREUM NODE (fallback, contracts.json has per-contract servers) +# ---------------------------------------------------------------------------- specific: - eth_server: "https://data-seed-prebsc-1-s1.bnbchain.org:8545" + eth_server: "https://data-seed-prebsc-1-s1.bnbchain.org:8545" # Default ETH RPC + +# ============================================================================ +# CONTRACTS CONFIGURATION (in contracts.json) +# ============================================================================ +# Contracts are defined in a separate contracts.json file with structure: +# { +# "contracts": [ +# { +# "name": "ContractName", # Contract identifier for API calls +# "server": "https://rpc.url", # ETH RPC endpoint for this contract +# "abi": "[{...}]", # Contract ABI as JSON string +# "address": "0x...", # Contract address on chain +# "private": "...", # Private key for signing (hex, no 0x) +# "gas_limit": 10000000 # Gas limit for transactions +# } +# ] +# } +# ============================================================================ diff --git a/worker/ethereum/sai-ethereum-indexer/config.md b/worker/ethereum/sai-ethereum-indexer/config.md new file mode 100644 index 0000000..5ad1142 --- /dev/null +++ b/worker/ethereum/sai-ethereum-indexer/config.md @@ -0,0 +1,223 @@ +# Ethereum Indexer Configuration + +This document describes all configuration options for the `config.json` file. + +Source: `worker/ethereum/sai-ethereum-indexer/config/config.go` + +## Configuration Structure + +```json +{ + "common": { ... }, + "specific": { ... }, + "contracts": [ ... ] +} +``` + +--- + +## `common` - Server Settings + +Framework-level server configuration. + +Source: `internal/config-internal/config-internal.go` + +| Field | Type | Description | +|-------|------|-------------| +| `common.http_server.enabled` | bool | Enable HTTP server for API endpoints | +| `common.http_server.host` | string | HTTP server bind address (e.g., "0.0.0.0") | +| `common.http_server.port` | string | HTTP server port (e.g., "8881") | +| `common.socket_server.enabled` | bool | Enable raw socket server | +| `common.socket_server.host` | string | Socket server bind address | +| `common.socket_server.port` | string | Socket server port | +| `common.web_socket.enabled` | bool | Enable WebSocket client connection | +| `common.web_socket.token` | string | Auth token for WebSocket connection | +| `common.web_socket.url` | string | WebSocket server URL to connect to | + +### Example + +```json +"common": { + "http_server": { + "enabled": true, + "host": "0.0.0.0", + "port": "8881" + }, + "socket_server": { + "enabled": false, + "host": "0.0.0.0", + "port": "8809" + }, + "web_socket": { + "enabled": false, + "token": "auth_token", + "url": "localhost:8820" + } +} +``` + +--- + +## `specific` - Indexer Settings + +Ethereum indexer-specific configuration. + +Source: `config/config.go:17-26` + +| Field | Type | Default | Description | +|-------|------|---------|-------------| +| `geth_server` | string | - | Ethereum JSON-RPC endpoint URL | +| `start_block` | int | 0 | Block number to start indexing from | +| `operations` | []string | [] | List of operations to perform (e.g., "exportTokens") | +| `sleep` | int | 2 | Seconds to wait between polling for new blocks | +| `skipFailedTransactions` | bool | false | Skip transactions that failed on-chain | + +### `specific.storage` - Storage Service Connection + +| Field | Type | Description | +|-------|------|-------------| +| `collection` | string | MongoDB collection name for indexed data | +| `token` | string | Auth token for storage service | +| `url` | string | Storage service URL (sai-storage-mongo) | +| `email` | string | Email for auth (alternative to token) | +| `password` | string | Password for auth (alternative to token) | + +### `specific.notifier` - Notification Service + +| Field | Type | Description | +|-------|------|-------------| +| `sender_id` | string | Identifier for notification source | +| `token` | string | Auth token for notifier service | +| `url` | string | Notifier service URL | +| `email` | string | Email for auth (alternative to token) | +| `password` | string | Password for auth (alternative to token) | + +### `specific.websocket` - WebSocket Output + +| Field | Type | Description | +|-------|------|-------------| +| `token` | string | Auth token for WebSocket connection | +| `url` | string | WebSocket server URL to push updates to | + +### Example + +```json +"specific": { + "geth_server": "https://data-seed-prebsc-1-s1.bnbchain.org:8545", + "storage": { + "collection": "Ethereum", + "token": "12345", + "url": "http://storage.local:8880", + "email": "", + "password": "" + }, + "notifier": { + "sender_id": "Ethereum", + "token": "notification_token", + "url": "http://localhost:8885", + "email": "", + "password": "" + }, + "start_block": 42108003, + "operations": ["exportTokens"], + "skipFailedTransactions": true, + "sleep": 20, + "websocket": { + "token": "ws_token", + "url": "http://test-websocket:8820" + } +} +``` + +--- + +## `contracts` - Smart Contract Definitions + +Define contracts to monitor and index. Can also be stored in separate `contracts.json` file. + +Source: `config/config.go:46-60` + +| Field | Type | Required | Description | +|-------|------|----------|-------------| +| `name` | string | No | Human-readable contract name | +| `address` | string | Yes | Contract address on chain (0x...) | +| `abi` | string | Yes | Contract ABI as JSON string | +| `start_block` | int | Yes | Block number to start indexing this contract from | + +### Example + +```json +"contracts": [ + { + "name": "Bridge", + "address": "0x719CAe5e3d135364e5Ef5AAd386985D86A0E7813", + "abi": "[{\"inputs\":[...]}]", + "start_block": 42108003 + } +] +``` + +--- + +## Complete Example + +```json +{ + "common": { + "http_server": { + "enabled": true, + "host": "0.0.0.0", + "port": "8881" + }, + "socket_server": { + "enabled": false, + "host": "0.0.0.0", + "port": "8809" + }, + "web_socket": { + "enabled": false, + "token": "1", + "url": "localhost:8820" + } + }, + "specific": { + "geth_server": "https://data-seed-prebsc-1-s1.bnbchain.org:8545", + "storage": { + "collection": "Ethereum", + "token": "12345", + "url": "http://storage.local:8880", + "email": "", + "password": "" + }, + "notifier": { + "sender_id": "Ethereum", + "token": "notification_token", + "url": "http://localhost:8885", + "email": "", + "password": "" + }, + "start_block": 42108003, + "operations": ["exportTokens"], + "skipFailedTransactions": true, + "sleep": 20, + "websocket": { + "token": "ws_token", + "url": "http://test-websocket:8820" + } + }, + "contracts": [ + { + "name": "Bridge", + "address": "0x719CAe5e3d135364e5Ef5AAd386985D86A0E7813", + "abi": "[...]", + "start_block": 42108003 + } + ] +} +``` + +--- + +## Environment Variables + +No environment variables are directly used by this service. All configuration is file-based. diff --git a/worker/sai-storage-mongo/config.yml b/worker/sai-storage-mongo/config.yml index c8f2017..92e67ec 100644 --- a/worker/sai-storage-mongo/config.yml +++ b/worker/sai-storage-mongo/config.yml @@ -1,24 +1,72 @@ +# ============================================================================ +# SAI STORAGE MONGO CONFIGURATION +# ============================================================================ +# MongoDB storage service providing persistence for all INTERX services. +# Source: worker/sai-storage-mongo/types/storage.go +# ============================================================================ + +# Common server settings (sai-service framework pattern) common: - version: "2.0" + version: "2.0" # Config version socket: - enabled: false - port: 8882 + enabled: false # Enable socket server + port: 8882 # Socket port http: - enabled: true - port: 8880 + enabled: true # Enable HTTP server for storage API + port: 8880 # HTTP port ws: - enabled: false - port: 8881 + enabled: false # Enable WebSocket server + port: 8881 # WebSocket port + +# ---------------------------------------------------------------------------- +# MONGODB CONNECTION +# Struct: types/storage.go:3-16 +# ---------------------------------------------------------------------------- storage: - atlas: false - host: "mongo.local" - port: "27017" - user: "" - pass: "" - database: "sai" + # MongoDB Atlas cloud hosting (mutually exclusive with host/port) + atlas: false # Use MongoDB Atlas cloud service + + # Self-hosted MongoDB connection + host: "mongo.local" # MongoDB server hostname + port: "27017" # MongoDB server port + + # Authentication credentials + user: "" # MongoDB username (leave empty for no auth) + pass: "" # MongoDB password + + # Database name + database: "sai" # Database name to use + + # Full connection string (overrides host/port/user/pass if set) + # Format: mongodb://user:pass@host:port/database?options connectionString: "" - duplicate: false - duplicateURL: "" - duplicateTimeout: 400 - duplicatePause: 3 - duplicateMethod: "notify" + + # -------------------------------------------------------------------------- + # DATA DUPLICATION / REPLICATION + # -------------------------------------------------------------------------- + # Sends copies of data to another service (e.g., for backup or sync) + + duplicate: false # Enable data duplication + duplicateURL: "" # Target URL for duplicated data + duplicateTimeout: 400 # Timeout in ms for duplicate requests + duplicatePause: 3 # Pause in seconds between duplicate batches + duplicateMethod: "notify" # Method: "notify" (async) or other + +# ============================================================================ +# ENVIRONMENT VARIABLES (alternative to config file) +# ============================================================================ +# Can be set via environment variables (see .env.dev): +# +# ATLAS=false # Use MongoDB Atlas +# HOST=mongo-db # MongoDB host +# PORT=27017 # MongoDB port +# USER= # MongoDB username +# PASS= # MongoDB password +# DB=sai # Database name +# CONNECTION_STRING= # Full connection string +# DUPLICATE=false # Enable duplication +# DUPLICATE_URL= # Duplication target URL +# DUPLICATE_TIMEOUT=400 # Duplication timeout (ms) +# DUPLICATE_PAUSE=3 # Duplication pause (seconds) +# DUPLICATE_METHOD=notify # Duplication method +# ============================================================================