### Clone and Navigate to Example Directory Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/x402-facilitator-plugin/README.md Clone the repository and navigate to the x402-facilitator-plugin example directory to begin setup. ```bash git clone https://github.com/OpenZeppelin/openzeppelin-relayer cd openzeppelin-relayer/examples/x402-facilitator-plugin ``` -------------------------------- ### Clone and Navigate to Example Directory Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/launchtube-plugin-example/README.md Clone the OpenZeppelin Relayer repository and navigate to the LaunchTube plugin example directory to begin the setup process. ```bash git clone https://github.com/OpenZeppelin/openzeppelin-relayer cd openzeppelin-relayer/examples/launchtube-plugin-example ``` -------------------------------- ### Install and Build LaunchTube Plugin Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/launchtube-plugin-example/README.md Install Node.js dependencies and build the LaunchTube plugin from its directory within the example. ```bash cd launchtube pnpm install pnpm run build cd .. ``` -------------------------------- ### Clone and Navigate to Example Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/channels-plugin-example/README.md Clone the OpenZeppelin Relayer repository and navigate to the channels-plugin-example directory to begin setup. ```bash git clone https://github.com/OpenZeppelin/openzeppelin-relayer cd openzeppelin-relayer/examples/channels-plugin-example ``` -------------------------------- ### Install Dependencies Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/CONTRIBUTING.md Use this command to install project dependencies during development setup. ```sh cargo build ``` -------------------------------- ### Configuration File Example Source: https://context7.com/openzeppelin/openzeppelin-relayer/llms.txt Complete example of the main config.json file structure for the OpenZeppelin Relayer. ```APIDOC ## Configuration File Example ### Description Complete example of the main config.json file structure. ### File Structure ```json { "relayers": [ { "id": "sepolia-example", "name": "Sepolia Example", "network": "sepolia", "paused": false, "notification_id": "notification-example", "signer_id": "local-signer", "network_type": "evm", "policies": { "min_balance": 100000000000000000 } }, { "id": "solana-example", "name": "Solana Example", "network": "devnet", "paused": false, "notification_id": "notification-example", "signer_id": "local-signer", "network_type": "solana", "policies": { "fee_payment_strategy": "user", "min_balance": 0, "allowed_programs": ["11111111111111111111111111111111"], "allowed_tokens": [ { "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "max_allowed_fee": 100000000 } ] } }, { "id": "stellar-example", "name": "Stellar Example", "network": "testnet", "paused": false, "notification_id": "notification-example", "signer_id": "local-signer", "network_type": "stellar" } ], "notifications": [ { "id": "notification-example", "type": "webhook", "url": "https://webhook.site/your-unique-url", "signing_key": { "type": "env", "value": "WEBHOOK_SIGNING_KEY" } } ], "signers": [ { "id": "local-signer", "type": "local", "config": { "path": "config/keys/local-signer.json", "passphrase": { "type": "env", "value": "KEYSTORE_PASSPHRASE" } } } ], "networks": "./config/networks", "plugins": [ { "id": "channels-plugin", "path": "channels/index.ts", "timeout": 60, "emit_logs": true, "emit_traces": true } ] } ``` ``` -------------------------------- ### Copy Environment Example File Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/evm-aws-kms-signer/README.md Create a new environment file by copying the provided example file. ```bash cp examples/evm-aws-kms-signer/.env.example examples/evm-aws-kms-signer/.env ``` -------------------------------- ### Configuration File Example Source: https://context7.com/openzeppelin/openzeppelin-relayer/llms.txt A complete example of the `config.json` file, demonstrating the structure for defining relayers, notifications, signers, networks, and plugins. ```json { "relayers": [ { "id": "sepolia-example", "name": "Sepolia Example", "network": "sepolia", "paused": false, "notification_id": "notification-example", "signer_id": "local-signer", "network_type": "evm", "policies": { "min_balance": 100000000000000000 } }, { "id": "solana-example", "name": "Solana Example", "network": "devnet", "paused": false, "notification_id": "notification-example", "signer_id": "local-signer", "network_type": "solana", "policies": { "fee_payment_strategy": "user", "min_balance": 0, "allowed_programs": ["11111111111111111111111111111111"], "allowed_tokens": [ { "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "max_allowed_fee": 100000000 } ] } }, { "id": "stellar-example", "name": "Stellar Example", "network": "testnet", "paused": false, "notification_id": "notification-example", "signer_id": "local-signer", "network_type": "stellar" } ], "notifications": [ { "id": "notification-example", "type": "webhook", "url": "https://webhook.site/your-unique-url", "signing_key": { "type": "env", "value": "WEBHOOK_SIGNING_KEY" } } ], "signers": [ { "id": "local-signer", "type": "local", "config": { "path": "config/keys/local-signer.json", "passphrase": { "type": "env", "value": "KEYSTORE_PASSPHRASE" } } } ], "networks": "./config/networks", "plugins": [ { "id": "channels-plugin", "path": "channels/index.ts", "timeout": 60, "emit_logs": true, "emit_traces": true } ] } ``` -------------------------------- ### Quick Start with Claude Skill Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/testing/wiremock/README.md Use the Claude skill for quick setup of the proxy for Stellar or EVM networks, including custom RPC URLs. Also shows how to arm scenarios, check metrics, and tear down. ```bash # Setup proxy for Stellar testnet /wiremock-test setup stellar # Setup with custom RPC URL /wiremock-test setup stellar https://my-custom-rpc.example.com # Setup for EVM (Anvil on localhost:8545) /wiremock-test setup evm # Arm a scenario /wiremock-test try-again-later # Check metrics after transaction /wiremock-test check-metrics # Tear down /wiremock-test teardown ``` -------------------------------- ### Copy Environment Example Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/aws-sqs-queue-storage/README.md Copy the example environment file to `.env` for local configuration. You will need to set `KEYSTORE_PASSPHRASE`, `API_KEY`, and `WEBHOOK_SIGNING_KEY`. ```bash cp examples/aws-sqs-queue-storage/.env.example examples/aws-sqs-queue-storage/.env ``` -------------------------------- ### Copy Environment File Example Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/solana-cdp-signer/README.md Copy the example environment file to create your own configuration file for the relayer service. ```bash cp examples/solana-cdp-signer/.env.example examples/solana-cdp-signer/.env ``` -------------------------------- ### Installation Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/docs/1.4.x/plugins/channels.mdx Instructions for installing the Channels plugin's TypeScript client. ```APIDOC ## Installation ```bash npm install @openzeppelin/relayer-plugin-channels # or pnpm add @openzeppelin/relayer-plugin-channels ``` ``` -------------------------------- ### Install and Build x402 Facilitator Plugin Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/x402-facilitator-plugin/README.md Install Node.js dependencies and build the x402 Facilitator plugin. Ensure you are in the `examples/x402-facilitator-plugin` directory. ```bash # From this directory (examples/x402-facilitator-plugin) cd x402-facilitator pnpm install pnpm run build cd .. ``` -------------------------------- ### Copy Environment Example File Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/redis-storage/README.md Copy the example environment file to create your active environment configuration. Remember to update sensitive fields like KEYSTORE_PASSPHRASE. ```bash cp examples/redis-storage/.env.example examples/redis-storage/.env ``` -------------------------------- ### Copy Environment File Example Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/tests/integration/README.md Use this command to create a local `.env.integration` file from its example template. This file stores API keys and secrets. ```bash cp .env.integration.example .env.integration ``` -------------------------------- ### Start OpenZeppelin Relayer Service Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/x402-facilitator-plugin/README.md Use this command to start the relayer service using Docker Compose. Ensure you have Docker installed and the docker-compose.yml file configured. ```bash docker compose up ``` -------------------------------- ### Install Pre-Commit Hooks Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/CONTRIBUTING.md Install and configure pre-commit hooks for the project. Ensure pip is installed or use pipx for global installation. ```sh pip install pre-commit pre-commit install --install-hooks -t commit-msg -t pre-commit -t pre-push ``` -------------------------------- ### Copy Example Configuration Files Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/tests/integration/README.md Commands to copy example configuration files for Local Mode and Testnet Mode. These commands create the necessary configuration files from templates. ```bash # For Local Mode (Anvil + Docker) cp tests/integration/config/config.example.json tests/integration/config/local/config.json cp tests/integration/config/registry.example.json tests/integration/config/local/registry.json # For Testnet Mode cp tests/integration/config/config.example.json tests/integration/config/testnet/config.json cp tests/integration/config/registry.example.json tests/integration/config/testnet/registry.json ``` -------------------------------- ### Install Channels Plugin Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/docs/1.4.x/plugins/channels.mdx Install the Channels plugin package using npm or pnpm. ```bash npm install @openzeppelin/relayer-plugin-channels # or pnpm add @openzeppelin/relayer-plugin-channels ``` -------------------------------- ### Install and Build Channels Plugin Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/channels-plugin-example/README.md Install Node.js dependencies and build the Channels plugin from its directory. ```bash cd channel pnpm install pnpm run build cd .. ``` -------------------------------- ### Copy Environment File Example Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/solana-aws-kms-signer/README.md Create a new .env file for your Solana AWS KMS signer configuration by copying the provided example file. ```bash cp examples/solana-aws-kms-signer/.env.example examples/solana-aws-kms-signer/.env ``` -------------------------------- ### Install Node.js and TypeScript Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/README.md Install Node.js from the official website and then globally install TypeScript and ts-node using npm. These are required for the Node.js-based components of the relayer. ```bash npm install -g typescript ts-node ``` -------------------------------- ### Copy Relayer Environment Example Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/evm-gcp-kms-signer/README.md Copy the example environment file to create a new configuration file for the relayer service. ```bash cp examples/evm-gcp-kms-signer/.env.example examples/evm-gcp-kms-signer/.env ``` -------------------------------- ### Start Services with Cargo Make Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/README.md Uses the 'docker-compose-up' target from the Makefile to start all services defined in docker-compose, including the relayer and Redis. Metrics services may start if METRICS_ENABLED is true in .env. ```bash cargo make docker-compose-up ``` -------------------------------- ### Automated Setup Script Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/docs/1.4.x/plugins/channels.mdx Information on using the automated setup script to streamline the creation of signers and relayers. ```APIDOC ## Automated Setup To skip the manual configuration steps, use the provided automation script. It automates the entire setup process: creating signers and relayers via the API, funding accounts on-chain, and registering them with Channels. ### Prerequisites When using the automated setup, you only need to configure and fund the **_fund account_**: ### Request Body Example (Fund Account Configuration) ```json { "relayers": [ { "id": "channels-fund", "chain": "stellar", "signer": "channels-fund-signer", "policies": { "concurrent_transactions": true } } ] } ``` The script creates all channel account signers and relayers dynamically - no config.json entries needed for channel accounts. ### Running the Script ```bash pnpm exec tsx ./scripts/create-channel-accounts.ts \ --total 3 \ --base-url http://localhost:8080 \ --api-key \ --funding-relayer channels-fund \ --plugin-id channels-plugin \ --plugin-admin-secret \ --network testnet ``` **Parameters:** - `--total` (number): The total number of channel accounts to create. - `--base-url` (string): The base URL of the relayer API. - `--api-key` (string): The API key for authentication. - `--funding-relayer` (string): The ID of the funding relayer. - `--plugin-id` (string): The ID of the plugin to configure. - `--plugin-admin-secret` (string): The admin secret for the plugin. - `--network` (string): The network to use (e.g., `testnet`, `mainnet`). ``` -------------------------------- ### Example Test Registry Entry Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/tests/integration/README.md An example entry for the `registry.json` file, demonstrating how to configure the 'sepolia' network for testing. ```json { "networks": { "sepolia": { "network_name": "sepolia", "network_type": "evm", "contracts": { "simple_storage": "0x5379E27d181a94550318d4A44124eCd056678879", "test_erc20": "0x0000000000000000000000000000000000000000" }, "min_balance": "0.1", "enabled": true } } } ``` -------------------------------- ### Copy Environment File Example Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/solana-google-cloud-kms-signer/README.md Copy the example environment file to create a new file for your specific configuration. This file will store environment-specific settings. ```bash cp examples/solana-google-cloud-kms-signer/.env.example examples/solana-google-cloud-kms-signer/.env ``` -------------------------------- ### Install OpenZeppelin Relayer Plugin Channels Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/docs/1.4.x/guides/stellar-channels-guide.mdx Install the client library for the OpenZeppelin Stellar Channels Service using npm, pnpm, or yarn. ```bash npm install @openzeppelin/relayer-plugin-channels # or pnpm add @openzeppelin/relayer-plugin-channels # or yarn add @openzeppelin/relayer-plugin-channels ``` -------------------------------- ### Clone Repository and Install Hooks Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/README.md Clone the OpenZeppelin Relayer repository and install pre-commit hooks. Ensure pip is installed globally or use pipx if issues arise. ```bash git clone https://github.com/openzeppelin/openzeppelin-relayer cd openzeppelin-relayer ``` ```bash pip install pre-commit pre-commit install --install-hooks -t commit-msg -t pre-commit -t pre-push ``` -------------------------------- ### Copy Environment File Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/basic-example-metrics/README.md Copy the example environment file to create a new environment file for the basic example with metrics. This file will contain sensitive configuration details. ```bash cp examples/basic-example-metrics/.env.example examples/basic-example-metrics/.env ``` -------------------------------- ### Copy Environment File Example Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/vault-secret-signer/README.md Copy the example environment file to create a new .env file for your service configuration. This file will store sensitive credentials and settings. ```bash cp examples/vault-secret-signer/.env.example examples/vault-secret-signer/.env ``` -------------------------------- ### Manual Quick Start: Start WireMock Proxy Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/testing/wiremock/README.md Manually start the WireMock proxy using Docker Compose. Supports default Stellar testnet, EVM (Anvil), or custom RPC URLs via environment variables. ```bash # 1. Start WireMock proxy (Stellar testnet by default) docker compose -f testing/wiremock/docker-compose.yaml up -d # For EVM (Anvil): WIREMOCK_PROXY_TARGET=http://host.docker.internal:8545 \ docker compose -f testing/wiremock/docker-compose.yaml up -d # For custom RPC: WIREMOCK_PROXY_TARGET=https://my-rpc.example.com \ docker compose -f testing/wiremock/docker-compose.yaml up -d ``` -------------------------------- ### Automated Setup Configuration Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/docs/1.4.x/plugins/channels.mdx Minimal configuration for automated setup, focusing on the fund account. The script dynamically creates channel accounts. ```json { "relayers": [ { "id": "channels-fund", "chain": "stellar", "signer": "channels-fund-signer", "policies": { "concurrent_transactions": true } } ] } ``` -------------------------------- ### Start Docker Services Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/aws-sqs-queue-storage/README.md Start the relayer, Redis, LocalStack, and the SQS initialization service using Docker Compose. Set `INIT_SQS_QUEUE_TYPE=fifo` in your `.env` file to use FIFO queues instead of standard queues. ```bash docker compose -f examples/aws-sqs-queue-storage/docker-compose.yaml up ``` -------------------------------- ### Start Services with Docker Compose (With Metrics) Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/README.md Starts the relayer, Redis, and metrics-related services (Prometheus, Grafana) using Docker Compose with the 'metrics' profile. Requires METRICS_ENABLED=true in the .env file. ```bash docker compose --profile metrics up -d ``` -------------------------------- ### Signer Configuration Examples Source: https://context7.com/openzeppelin/openzeppelin-relayer/llms.txt Examples of different signer configurations including local, Vault, AWS KMS, and GCP KMS. Note the use of environment variables for sensitive credentials. ```json { "signers": [ { "id": "local-signer", "type": "local", "config": { "path": "config/keys/local-signer.json", "passphrase": {"type": "env", "value": "KEYSTORE_PASSPHRASE"} } }, { "id": "vault-signer", "type": "vault", "config": { "address": "https://vault.example.com", "role_id": {"type": "env", "value": "VAULT_ROLE_ID"}, "secret_id": {"type": "env", "value": "VAULT_SECRET_ID"}, "key_name": "relayer-key", "mount_point": "secret" } }, { "id": "aws-kms-signer", "type": "aws_kms", "config": { "region": "us-west-2", "key_id": "arn:aws:kms:us-west-2:123456789012:key/12345678-1234-1234-1234-123456789012" } }, { "id": "gcp-kms-signer", "type": "google_cloud_kms", "config": { "service_account": { "project_id": "your-gcp-project", "private_key_id": {"type": "env", "value": "GCP_PRIVATE_KEY_ID"}, "private_key": {"type": "env", "value": "GCP_PRIVATE_KEY"}, "client_email": {"type": "env", "value": "GCP_CLIENT_EMAIL"}, "client_id": "your-client-id" }, "key": { "location": "us-west2", "key_ring_id": "relayer-keyring", "key_id": "relayer-key", "key_version": 1 } } } ] } ``` -------------------------------- ### Docker Compose Deployment Example Source: https://context7.com/openzeppelin/openzeppelin-relayer/llms.txt Example docker-compose.yaml for deploying the relayer with Redis. It defines services for the relayer and Redis, including port mappings, environment variables, and volumes. ```yaml version: '3.8' services: relayer: build: context: . dockerfile: Dockerfile.production ports: - "8080:8080" - "8081:8081" environment: - LOG_LEVEL=info - CONFIG_DIR=/app/config - REDIS_URL=redis://redis:6379 - REPOSITORY_STORAGE_TYPE=redis - API_KEY=${API_KEY} - KEYSTORE_PASSPHRASE=${KEYSTORE_PASSPHRASE} - WEBHOOK_SIGNING_KEY=${WEBHOOK_SIGNING_KEY} volumes: - ./config:/app/config:ro depends_on: - redis redis: image: redis:latest ports: - "6379:6379" volumes: - redis-data:/data volumes: redis-data: ``` -------------------------------- ### Set Up Environment Variables Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/CONTRIBUTING.md Copy the example environment file to create your local configuration. ```sh cp .env.example .env ``` -------------------------------- ### Clone and Navigate to Example Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/channels-x402-plugin-example/README.md Clone the OpenZeppelin Relayer repository and navigate to the channels-x402-plugin-example directory. ```bash git clone https://github.com/OpenZeppelin/openzeppelin-relayer cd openzeppelin-relayer/examples/channels-x402-plugin-example ``` -------------------------------- ### Start Services with Docker Compose Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/horizontal-scaling/README.md Start all services defined in the Docker Compose file in detached mode. This command initiates the horizontally scaled relayer setup. ```bash docker compose -f examples/horizontal-scaling/docker-compose.yaml up -d ``` -------------------------------- ### Environment File Configuration Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/channels-x402-plugin-example/README.md Create a `.env` file in the example directory with necessary Redis, keystore, and Channels plugin configurations. Replace placeholders with your generated credentials and desired settings. ```env REDIS_URL=redis://redis:6379 KEYSTORE_PASSPHRASE_FUND=YOUR_PASSWORD KEYSTORE_PASSPHRASE_X402_FUND=YOUR_PASSWORD KEYSTORE_PASSPHRASE_CHANNEL_001=YOUR_PASSWORD KEYSTORE_PASSPHRASE_CHANNEL_002=YOUR_PASSWORD WEBHOOK_SIGNING_KEY= API_KEY= # Channels Configuration STELLAR_NETWORK=testnet PLUGIN_ADMIN_SECRET= FUND_RELAYER_ID=channels-fund ALLOWED_FUND_RELAYER_IDS=x402-channels-fund LOCK_TTL_SECONDS=30 LOG_LEVEL=info # Fee Tracking (optional) FEE_LIMIT=100000000 # Max fee per API key in stroops (optional) FEE_RESET_PERIOD_SECONDS=86400 # Reset fee consumption every N seconds (e.g., 86400 = 24 hours) API_KEY_HEADER=x-api-key # Header for fee tracking (default: x-api-key) # Contract Capacity Limits (optional) LIMITED_CONTRACTS=CONTRACT_ADDRESS_1,CONTRACT_ADDRESS_2 # Contracts with restricted pool access CONTRACT_CAPACITY_RATIO=0.8 # Pool portion for limited contracts (0-1, default: 0.8) ``` -------------------------------- ### Start Relayer with Local Plugin Override Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/launchtube-plugin-example/README.md Start the Docker Compose service with the development override file to mount your local plugin's 'dist/' directory. This replaces the installed package's built output with your local build. ```bash export LAUNCHTUBE_PLUGIN_LOCAL_DIST=$LAUNCHTUBE_PLUGIN_DIR/dist docker compose -f docker-compose.yaml -f docker-compose.plugin-dev.yaml up -d --build ``` -------------------------------- ### Retrieve Relayer Address Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/x402-facilitator-plugin/README.md After starting the relayer, use this curl command to get the relayer's address. Replace YOUR_API_KEY with your actual API key. ```bash curl -X GET http://localhost:8080/api/v1/relayers/stellar-example \ -H "Authorization: Bearer YOUR_API_KEY" ``` -------------------------------- ### Run OpenZeppelin Relayer Service with Docker Compose Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/solana-turnkey-signer/README.md Start the OpenZeppelin Relayer service using Docker Compose. This command assumes you have Docker and Docker Compose installed and configured. ```bash docker compose -f examples/solana-turnkey-signer/docker-compose.yaml up ``` -------------------------------- ### Run OpenZeppelin Relayer with Docker Compose Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/solana-aws-kms-signer/README.md Start the OpenZeppelin Relayer service using Docker Compose with the specified configuration file for the Solana AWS KMS signer example. ```bash docker compose -f examples/solana-aws-kms-signer/docker-compose.yaml up ``` -------------------------------- ### Copy Environment File Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/evm-turnkey-signer/README.md Copy the example environment file to create your own configuration. ```bash cp examples/evm-turnkey-signer/.env.example examples/evm-turnkey-signer/.env ``` -------------------------------- ### Switching RPC Target with Environment Variable Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/testing/wiremock/README.md Change the target RPC endpoint for the WireMock proxy by setting the `WIREMOCK_PROXY_TARGET` environment variable before starting WireMock with Docker Compose. Examples for Stellar mainnet and local Anvil are provided. ```bash # Stellar mainnet WIREMOCK_PROXY_TARGET=https://mainnet.sorobanrpc.com \ docker compose -f testing/wiremock/docker-compose.yaml up -d # Local Anvil WIREMOCK_PROXY_TARGET=http://host.docker.internal:8545 \ docker compose -f testing/wiremock/docker-compose.yaml up -d ``` -------------------------------- ### Main Configuration File Example Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/network-configuration-json-file/README.md This JSON file defines the main configuration, referencing network definitions from a separate file. ```json { "relayers": [...], "signers": [...], "notifications": [...], "networks": "./config/networks" } ``` -------------------------------- ### Channels Client Setup Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/docs/1.4.x/plugins/channels.mdx Demonstrates how to initialize the ChannelsClient for direct HTTP connection or via OpenZeppelin Relayer plugin. ```APIDOC ## Client Setup The client supports two connection modes that are automatically detected based on configuration: ```typescript import { ChannelsClient } from "@openzeppelin/relayer-plugin-channels"; // Direct HTTP connection to Channels service const directClient = new ChannelsClient({ baseUrl: "https://channels.openzeppelin.com", // Channels service URL apiKey: process.env.CHANNELS_API_KEY, // Service API key adminSecret: process.env.CHANNELS_ADMIN, // Optional: for management timeout: 30000, // Optional: request timeout }); // Connection via OpenZeppelin Relayer plugin const relayerClient = new ChannelsClient({ pluginId: "channels-plugin", // Plugin identifier (triggers relayer mode) baseUrl: "http://localhost:8080", // Relayer URL apiKey: process.env.RELAYER_API_KEY, // Relayer API key (sent as Bearer AND custom header) apiKeyHeader: "x-api-key", // Optional: header for fee tracking (default: x-api-key) adminSecret: process.env.CHANNELS_ADMIN, // Optional: for management }); ``` ``` -------------------------------- ### Create Environment File Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/network-configuration-config-file/README.md Copy the example environment file to create your own .env file. Update the necessary variables for Redis, keystore passphrase, webhook signing key, and API key. ```bash cp examples/network-configuration-config-file/.env.example examples/network-configuration-config-file/.env ``` -------------------------------- ### Relayer Configuration Example Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/docs/1.4.x/plugins/channels.mdx Example of the config.json file showing the structure for defining relayers and signers. ```APIDOC ## Relayer Configuration Channels requires two types of relayers: 1. **_Fund Account_**: The account that pays transaction fees (should have `concurrent_transactions: true` enabled) 2. **_Channel Accounts_**: At least one channel account (recommended: 2 or more for better throughput) Configure relayers in your `config/config.json`: ### Request Body Example ```json { "relayers": [ { "id": "channels-fund", "name": "Channels Fund Account", "network": "testnet", "paused": false, "network_type": "stellar", "signer_id": "channels-fund-signer", "policies": { "concurrent_transactions": true } }, { "id": "channel-001", "name": "Channel Account 001", "network": "testnet", "paused": false, "network_type": "stellar", "signer_id": "channel-001-signer" }, { "id": "channel-002", "name": "Channel Account 002", "network": "testnet", "paused": false, "network_type": "stellar", "signer_id": "channel-002-signer" } ], "notifications": [], "signers": [ { "id": "channels-fund-signer", "type": "local", "config": { "path": "config/keys/channels-fund.json", "passphrase": { "type": "env", "value": "KEYSTORE_PASSPHRASE_FUND" } } }, { "id": "channel-001-signer", "type": "local", "config": { "path": "config/keys/channel-001.json", "passphrase": { "type": "env", "value": "KEYSTORE_PASSPHRASE_CHANNEL_001" } } }, { "id": "channel-002-signer", "type": "local", "config": { "path": "config/keys/channel-002.json", "passphrase": { "type": "env", "value": "KEYSTORE_PASSPHRASE_CHANNEL_002" } } } ], "networks": "./config/networks", "plugins": [ { "id": "channels", "path": "channel/index.ts", "timeout": 30, "emit_logs": true, "emit_traces": true } ] } ``` **_Important Configuration Notes:_** - **_Fund Account_** (`channels-fund`): Must have `"concurrent_transactions": true` in policies to enable parallel transaction processing - **_Channel Accounts_**: Create at least 2 for better throughput (you can add more as `channel-003`, etc.) - **_Network_**: Use `testnet` for testing or `mainnet` for production - **_Signers_**: Each relayer references a signer by `signer_id`, and signers are defined separately with keystore paths - **_Keystore Files_**: You’ll need to create keystore files for each account - see [OpenZeppelin Relayer documentation](https://docs.openzeppelin.com/relayer) for details on creating and managing keys - **_Plugin Registration_**: The plugin `id` should match what you use in environment variables and API calls After configuration, fund these accounts on-chain and register them with Channels (see "Initializing Channel Accounts" below). ``` -------------------------------- ### Network Configuration File Example (EVM) Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/network-configuration-json-file/README.md This JSON file defines EVM network configurations, including mainnet and testnets with inheritance. ```json { "mainnet": { "chain_id": 1, "required_confirmations": 12, "rpc_urls": ["https://mainnet.infura.io/v3/YOUR_INFURA_KEY"], "explorer_urls": ["https://etherscan.io"], "is_testnet": false }, "sepolia": { "from": "mainnet", "chain_id": 11155111, "required_confirmations": 6, "rpc_urls": ["https://sepolia.infura.io/v3/YOUR_INFURA_KEY"], "explorer_urls": ["https://sepolia.etherscan.io"], "is_testnet": true }, "holesky": { "from": "mainnet", "chain_id": 17000, "required_confirmations": 6, "rpc_urls": ["https://rpc.holesky.ethpandaops.io"], "explorer_urls": ["https://holesky.etherscan.io"], "is_testnet": true } } ``` -------------------------------- ### Example Signer Configuration Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/docs/1.4.x/configuration/signers.mdx This is a general example of a signer configuration object within the relayer configuration. ```json "signers": [ { "id": "my_id", "type": "local", "config": { "path": "config/keys/local-signer.json", "passphrase": { "type": "env", "value": "KEYSTORE_PASSPHRASE" } } } ] ``` -------------------------------- ### Copy and Update .env File Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/basic-example-logging/README.md Copy the example .env file to create your active environment file and update the KEYSTORE_PASSPHRASE with your chosen password. ```bash cp examples/basic-example-logging/.env.example examples/basic-example-logging/.env ``` -------------------------------- ### Create Signer Keystore for Testnet Mode Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/tests/integration/README.md This command uses the `create_key` example to generate a signer keystore for testnet mode. Specify your password and output directory. ```bash # For Testnet Mode - using the recommended key generation tool cargo run --example create_key -- \ --password "DEFINE_YOUR_PASSWORD" \ --output-dir tests/integration/config/testnet/keys \ --filename local-signer.json ``` -------------------------------- ### Install Rust Toolchain Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/README.md Install the rustfmt component for the Rust toolchain. This is necessary for code formatting checks. ```bash rustup component add rustfmt ``` -------------------------------- ### Copy Environment File Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/evm-cdp-signer/README.md Copy the example environment file to create your own configuration file for the relayer service. ```bash cp examples/evm-cdp-signer/.env.example examples/evm-cdp-signer/.env ``` -------------------------------- ### Copy Configuration Files Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/README.md Copy example configuration files to their active counterparts. This sets up the initial configuration structure for the relayer. ```bash cp config/config.example.json config/config.json ``` ```bash cp .env.example .env ``` -------------------------------- ### Install libsodium on Debian/Ubuntu Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/README.md Install build-essential and libsodium on Debian/Ubuntu systems if compiling libsodium from source. This is a prerequisite for certain cryptographic operations. ```bash sudo apt-get update && sudo apt-get install -y build-essential ``` -------------------------------- ### Manual Quick Start: Configure Relayer and Arm Scenario Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/testing/wiremock/README.md Configure your relayer's network RPC URL to point to the proxy, then arm a specific scenario using helper scripts. Transactions will hit the mock response once before reverting to real RPC. ```bash # 2. Point your relayer's network RPC URL to the proxy # In config/networks/stellar.json (or your local network config): # "rpc_urls": ["http://localhost:9090"] # 3. Start the relayer normally — all RPC traffic flows through WireMock to the target # 4. When ready to test, arm a scenario: ./testing/wiremock/scripts/trigger-try-again-later.sh # or ./testing/wiremock/scripts/trigger-insufficient-fee.sh # 5. Submit a transaction — it will hit the mock response once, then revert to real RPC # 6. Check relayer metrics: curl -s http://localhost:8081/debug/metrics/scrape | grep -E "insufficient_fee|try_again_later" ``` -------------------------------- ### Create Signer Keystore Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/aws-sqs-queue-storage/README.md Generate a local signer keystore using the `create_key` example. Ensure you replace `` with your actual password. ```bash cargo run --example create_key -- \ --password \ --output-dir examples/aws-sqs-queue-storage/config/keys \ --filename local-signer.json ``` -------------------------------- ### GET /api/v1/plugins/{pluginId}/call Source: https://context7.com/openzeppelin/openzeppelin-relayer/llms.txt Executes a plugin via GET request for read-only operations. This is useful for operations that do not require a request body. ```APIDOC ## GET /api/v1/plugins/{pluginId}/call ### Description Executes a plugin via GET request for read-only operations. ### Method GET ### Endpoint `/api/v1/plugins/{pluginId}/call` ### Parameters #### Path Parameters - **pluginId** (string) - Required - The ID of the plugin to call. #### Query Parameters - **route** (string) - Required - The specific route or operation within the plugin to execute. ### Request Example ```bash curl -X GET "http://localhost:8080/api/v1/plugins/channels-plugin/call?route=/status" \ -H "Authorization: Bearer YOUR_API_KEY" ``` ### Response Response depends on plugin implementation. ``` -------------------------------- ### Configure Testnet Mode Files Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/tests/integration/README.md Copy and configure the example JSON files for testnet mode. Edit `tests/integration/config/testnet/config.json` and `tests/integration/config/testnet/registry.json` to enable desired networks. ```bash cp tests/integration/config/config.example.json tests/integration/config/testnet/config.json cp tests/integration/config/registry.example.json tests/integration/config/testnet/registry.json # Edit registry.json to enable the networks you want to test ``` -------------------------------- ### Start Relayer and Redis Services Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/vault-transit-signer/README.md This command starts the relayer and Redis services using Docker Compose. Ensure the docker-compose.yaml file is in the correct path. ```bash docker compose -f examples/vault-transit-signer/docker-compose.yaml up -d ``` -------------------------------- ### Copy Environment File Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/examples/basic-example/README.md Copy the example environment file to create a new .env file for your configuration. This file will store sensitive information and settings. ```bash cp examples/basic-example/.env.example examples/basic-example/.env ``` -------------------------------- ### Start Redis Instance with Docker Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/README.md Start a Redis instance in detached mode using Docker. This is required for running tests that depend on a Redis backend. ```bash docker run -d \ --name redis \ -p 6379:6379 \ redis:latest ``` -------------------------------- ### Setup Local Anvil Keystore with Cast Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/tests/integration/README.md Use `cast wallet import` to create a keystore for local Anvil testing. Replace `ANVIL_PRIVATE_KEY` with a pre-funded Anvil account's private key. Ensure the keystore file is moved to the correct location. ```bash cast wallet import anvil-test \ --private-key ANVIL_PRIVATE_KEY \ --keystore-dir tests/integration/config/local/keys \ --unsafe-password "test" mv tests/integration/config/local/keys/anvil-test \ tests/integration/config/local/keys/anvil-test.json ``` -------------------------------- ### Call Plugin (GET) Source: https://context7.com/openzeppelin/openzeppelin-relayer/llms.txt Executes a plugin via a GET request, suitable for read-only operations. The route parameter specifies the operation within the plugin. ```bash curl -X GET "http://localhost:8080/api/v1/plugins/channels-plugin/call?route=/status" \ -H "Authorization: Bearer YOUR_API_KEY" ``` -------------------------------- ### Install Channels Plugin in Relayer Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/docs/1.4.x/plugins/channels.mdx Add the Channels plugin to an existing OpenZeppelin Relayer installation by navigating to the plugins directory and using pnpm to add the package. ```bash # From the root of your Relayer repository cd plugins pnpm add @openzeppelin/relayer-plugin-channels ``` -------------------------------- ### Create Registry JSON Files Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/tests/integration/README.md These commands copy the example `registry.json` file to specific mode directories (local and testnet). You will then edit these files to enable or disable networks for testing. ```bash # For Local Mode (Anvil with Docker) cp tests/integration/config/registry.example.json tests/integration/config/local/registry.json # For Testnet Mode cp tests/integration/config/registry.example.json tests/integration/config/testnet/registry.json ``` -------------------------------- ### Install and Configure Pre-Commit Hooks Source: https://github.com/openzeppelin/openzeppelin-relayer/blob/main/CONTRIBUTING.md Installs the pre-commit package and configures hooks for commit-msg, pre-commit, and pre-push. These hooks ensure code quality and consistency before committing. ```sh # Use if you prefer to install it globally pip install pre-commit pre-commit install --install-hooks -t commit-msg -t pre-commit -t pre-push ```