### Run Go Client Example Source: https://github.com/symbioticfi/relay/blob/dev/DEVELOPMENT.md Navigates to the Go client examples directory, updates the 'main.go' file to reflect API changes, and then runs the example using 'go run main.go'. Assumes necessary setup steps are followed. ```bash cd api/client/examples # Update main.go to reflect API changes vim main.go # Test the example, follow the readme and test go run main.go ``` -------------------------------- ### Configure and Run Tests with Custom Environment Variables (Bash) Source: https://github.com/symbioticfi/relay/blob/dev/e2e/README.md This example demonstrates how to set custom environment variables to configure the test environment before running the setup script and starting the network. It shows how to override defaults for operators, commiters, aggregators, verification type, epoch time, and block time. The sequence includes setting variables, running setup, starting the network, and executing tests. ```bash # Set custom configuration export OPERATORS=6 export COMMITERS=2 export AGGREGATORS=1 export VERIFICATION_TYPE=0 export EPOCH_TIME=32 export BLOCK_TIME=2 # Run setup ./setup.sh # Start network cd temp-network docker compose up -d cd .. # Run tests cd tests go test -v ``` -------------------------------- ### Update Rust Client Example Source: https://github.com/symbioticfi/relay/blob/dev/DEVELOPMENT.md Updates Rust client examples after proto changes. This involves navigating to the examples directory, editing example files (e.g., 'basic_usage.rs'), building the project, and running the example. ```bash cd examples/ # Update example files to use new API vim basic_usage.rs cargo build cargo run --example basic_usage ``` -------------------------------- ### Run Basic Symbiotic Relay Client Example (Bash) Source: https://github.com/symbioticfi/relay/blob/dev/api/client/examples/README.md This command executes the main example file for the Symbiotic Relay Go client. It demonstrates basic interactions with a Symbiotic Relay server. The default server is localhost:8080, but can be overridden using the RELAY_SERVER_URL environment variable. ```bash cd api/client/examples go run main.go ``` ```bash RELAY_SERVER_URL=my-relay-server:8081 go run main.go ``` -------------------------------- ### Setup Test Environment with Shell Script Source: https://github.com/symbioticfi/relay/blob/dev/e2e/README.md This script sets up the necessary environment for running end-to-end tests. It may involve downloading dependencies or preparing configuration files. The primary input is the script itself, and the output is a prepared testing environment. ```bash ./setup.sh ``` -------------------------------- ### Update TypeScript Client Example Source: https://github.com/symbioticfi/relay/blob/dev/DEVELOPMENT.md Updates TypeScript client examples after proto changes. This involves navigating to the examples directory, editing example files (e.g., 'basic-usage.ts'), building the project, and running the example. ```bash cd examples/ # Update example files to use new API vim basic-usage.ts npm run build npm run basic-usage ``` -------------------------------- ### Automated Local Relay Network Setup (Bash) Source: https://github.com/symbioticfi/relay/blob/dev/README.md This command automates the setup of a local relay network, including building the Docker image, starting blockchain nodes, deploying contracts, generating configurations, and launching relay nodes. ```bash make local-setup ``` -------------------------------- ### Start Local Blockchain Network with Docker Compose Source: https://github.com/symbioticfi/relay/blob/dev/e2e/README.md This command sequence initializes and starts a local blockchain network using Docker Compose. It requires navigating to the 'temp-network' directory and running 'docker compose up -d'. The output is a running Dockerized blockchain environment. ```bash cd temp-network docker compose up -d cd .. ``` -------------------------------- ### Update Go Client Package Version in Super Sum Example Source: https://github.com/symbioticfi/relay/blob/dev/DEVELOPMENT.md Updates the Go client package version within the 'off-chain' directory of the symbiotic-super-sum example. It modifies 'go.mod' to point to the latest relay version and tidies the module dependencies. ```bash cd off-chain # Update go.mod to use latest relay client go get github.com/symbioticfi/relay@ go mod tidy ``` -------------------------------- ### Get Current Epoch API Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/index.html Fetch the current epoch number and its start time. ```APIDOC ## POST /api/v1/GetCurrentEpoch ### Description Retrieves the current epoch number and the timestamp when the current epoch started. ### Method POST ### Endpoint /api/v1/GetCurrentEpoch ### Parameters *This endpoint does not require a request body.* ### Request Example ```json {} ``` ### Response #### Success Response (200) - **epoch** (uint64) - The current epoch number. - **start_time** (google.protobuf.Timestamp) - The timestamp indicating the start of the current epoch. #### Response Example ```json { "epoch": 54321, "start_time": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### Run Relay Sidecar with Configuration and Overrides Source: https://context7.com/symbioticfi/relay/llms.txt This section provides multiple command-line examples for running the relay sidecar. It demonstrates how to launch the service using a configuration file, override settings with command-line flags or environment variables, and deploy using Docker. These examples cover common deployment scenarios. ```bash # Run with configuration file ./relay_sidecar --config config.yaml # Override with command-line flags ./relay_sidecar \ --config config.yaml \ --log.level debug \ --api.listen ":8080" \ --api.http-gateway=true \ --driver.chain-id 1 \ --driver.address "0x..." \ --storage-dir /var/lib/relay # Override with environment variables export SYMB_LOG_LEVEL=debug export SYMB_API_LISTEN=":8080" export SYMB_API_HTTP_GATEWAY=true export SYMB_DRIVER_CHAIN_ID=1 export SYMB_DRIVER_ADDRESS="0x..." ./relay_sidecar --config config.yaml # Run with Docker docker run -v $(pwd)/config.yaml:/config.yaml \ symbioticfi/relay:latest \ --config /config.yaml # Download pre-built binary wget https://github.com/symbioticfi/relay/releases/latest/download/relay_sidecar_linux_amd64 chmod +x relay_sidecar_linux_amd64 ./relay_sidecar_linux_amd64 --config config.yaml ``` -------------------------------- ### Customizing Local Network Setup (Bash) Source: https://github.com/symbioticfi/relay/blob/dev/README.md Allows customization of the local relay network setup by setting environment variables before running the 'make local-setup' command. This enables control over the number of operators, committers, and aggregators. ```bash OPERATORS=6 COMMITERS=2 AGGREGATORS=1 make local-setup ``` -------------------------------- ### Run End-to-End Tests with Go Source: https://github.com/symbioticfi/relay/blob/dev/e2e/README.md Executes the end-to-end tests for the Symbiotic Relay project using the Go test runner. This command should be run from the 'tests' directory after the environment is set up and the network is started. It outputs detailed test results. ```bash cd tests go test -v ``` -------------------------------- ### StreamProofs Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/index.html Establishes a stream to listen for proof updates in real-time. Get live updates on proofs as they are generated. ```APIDOC ## GET /v1/stream/proofs ### Description Establishes a stream to listen for proof updates in real-time. Get live updates on proofs as they are generated. ### Method GET ### Endpoint /v1/stream/proofs ### Response #### Success Response (200) - **proof_update** (object) - Real-time updates on proofs. #### Response Example (Streaming response) { "proof_update": { ... } } ``` -------------------------------- ### StreamSignatures Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/index.html Establishes a stream to listen for signature updates in real-time. Use this to get live signature events. ```APIDOC ## GET /v1/stream/signatures ### Description Establishes a stream to listen for signature updates in real-time. Use this to get live signature events. ### Method GET ### Endpoint /v1/stream/signatures ### Response #### Success Response (200) - **signature_update** (object) - Real-time updates on signatures. #### Response Example (Streaming response) { "signature_update": { ... } } ``` -------------------------------- ### GetCurrentEpoch Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/doc.md Retrieves the current epoch number and its start time. ```APIDOC ## GetCurrentEpoch ### Description Fetches the current epoch number and the timestamp when the current epoch began. ### Method GET ### Endpoint /epoch/current ### Parameters #### Query Parameters None ### Request Example (No request body or parameters needed for this GET request) ### Response #### Success Response (200) - **epoch** (uint64) - The current epoch number. - **start_time** (google.protobuf.Timestamp) - The timestamp when the current epoch started. #### Response Example ```json { "epoch": 12345, "start_time": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### Listen to Aggregation Proofs Stream Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/index.html Establishes a stream to receive aggregation proofs. Allows starting from a specific epoch to catch up on historical data before receiving real-time updates. ```APIDOC ## POST /symbioticfi/relay/ListenProofs ### Description Listens for a stream of aggregation proofs. ### Method POST ### Endpoint /symbioticfi/relay/ListenProofs ### Parameters #### Request Body - **start_epoch** (uint64) - Optional - If provided, the stream will include historical proofs starting from this epoch. If not provided, only new proofs will be sent. ### Response #### Success Response (200 - Stream) - **request_id** (string) - The ID of the request. - **epoch** (uint64) - The epoch number for the proof. - **aggregation_proof** (AggregationProof) - The aggregation proof data. #### Response Example (for each stream message) { "request_id": "stream-abc", "epoch": 101, "aggregation_proof": { "proof": "0x...", "aggregator": "0x..." } } ``` -------------------------------- ### Structured Logging with Context Propagation in Go Source: https://github.com/symbioticfi/relay/blob/dev/DEVELOPMENT.md Demonstrates how to use structured logging with context propagation in Go using the `log/slog` package and a custom wrapper. It shows adding component tags and request-specific attributes to log entries for better context and debugging. ```go import ( "context" "log/slog" "github.com/symbioticfi/relay/pkg/log" ) func (s *Service) HandleRequest(ctx context.Context, req *Request) error { // 1. Add component tag (required) ctx = log.WithComponent(ctx, "aggregator") // 2. Add request-specific context (if applicable) ctx = log.WithAttrs(ctx, slog.Uint64("epoch", uint64(req.Epoch)), slog.String("requestId", req.RequestID.Hex()), ) // 3. All subsequent logs automatically include these fields slog.InfoContext(ctx, "Started processing request") // ... rest of implementation return nil } ``` -------------------------------- ### GET /v1/epoch/current - Get Current Epoch Source: https://context7.com/symbioticfi/relay/llms.txt Query the current epoch number and its start time. This endpoint provides information about the relay's current operational cycle. ```APIDOC ## GET /v1/epoch/current ### Description Query the current epoch number and its start time. ### Method GET ### Endpoint /v1/epoch/current ### Response #### Success Response (200) - **epoch** (integer) - The current epoch number. - **start_time** (string) - The ISO 8601 formatted timestamp indicating the start time of the current epoch. #### Response Example ```json { "epoch": 150, "start_time": "2026-01-11T10:00:00Z" } ``` ``` -------------------------------- ### Run All Project Linters with Make Source: https://github.com/symbioticfi/relay/blob/dev/DEVELOPMENT.md Runs all configured linters for the project, including buf for proto files and golangci-lint for Go code. This helps maintain code quality and consistency across the codebase. ```bash make lint ``` -------------------------------- ### Import and Initialize Symbiotic Relay Client (Go) Source: https://github.com/symbioticfi/relay/blob/dev/api/client/examples/README.md This Go code snippet demonstrates how to import the Symbiotic Relay client package and establish a connection to a gRPC server. It initializes the client with the provided server URL and handles potential connection errors. Proper connection cleanup is essential. ```go import client "github.com/symbioticfi/relay/api/client/v1" // ... serverURL := "your-relay-server-address" conn, err := grpc.Dial(serverURL, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { // Handle error appropriately return err } def err := conn.Close() client := client.NewSymbioticClient(conn) ``` -------------------------------- ### Get Current Epoch using REST and Go gRPC Source: https://context7.com/symbioticfi/relay/llms.txt Query the current epoch number and its corresponding start time. This endpoint is accessible via both REST and a Go gRPC client. It does not require any input parameters. ```bash # Using HTTP/JSON REST API curl http://localhost:8080/v1/epoch/current # Response: # { # "epoch": 150, # "start_time": "2026-01-11T10:00:00Z" # } ``` ```go resp, err := c.GetCurrentEpoch(ctx, &client.GetCurrentEpochRequest{}) if err != nil { log.Fatalf("GetCurrentEpoch failed: %v", err) } log.Printf("Current epoch: %d", resp.Epoch) log.Printf("Start time: %v", resp.StartTime.AsTime()) ``` -------------------------------- ### Get Last Committed Epoch using HTTP/REST Source: https://context7.com/symbioticfi/relay/llms.txt Queries the last committed epoch for a specific settlement chain ID. This functionality is available through the HTTP/JSON REST API. The response includes the settlement chain ID and epoch information, specifically the last committed epoch and its start time. ```bash # Using HTTP/JSON REST API curl http://localhost:8080/v1/committed/chain/31337 ``` -------------------------------- ### Context-Aware Logging Variants (Go) Source: https://github.com/symbioticfi/relay/blob/dev/DEVELOPMENT.md Demonstrates the preferred method for logging in Go using context-aware variants like 'slog.InfoContext' and 'slog.ErrorContext'. It contrasts this with the legacy pattern of using non-context-aware functions when context is available. ```go // ✅ Preferred (context-aware) slog.InfoContext(ctx, "Message processed", "count", count) slog.ErrorContext(ctx, "Failed to process", "error", err) // ⚠️ Avoid when context is available (legacy pattern) slog.Info("Message processed", "count", count) slog.Error("Failed to process", "error", err) ``` -------------------------------- ### Operation Duration Tracking and Logging (Go) Source: https://github.com/symbioticfi/relay/blob/dev/DEVELOPMENT.md Shows how to measure and log the duration of operations in Go for performance monitoring. It uses the 'time' package to record the start time and 'slog' to log the elapsed time along with other relevant context. ```go func (s *Service) ProcessSignature(ctx context.Context, sig *Signature) error { start := time.Now() // ... perform operation ... slog.InfoContext(ctx, "Signature processed successfully", "duration", time.Since(start), "requestId", sig.RequestID, ) return nil } ``` -------------------------------- ### ListenProofs Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/index.html Streams aggregation proofs in real-time. If `start_epoch` is provided, historical data is sent first. ```APIDOC ## POST /api/v1/ListenProofs ### Description Streams aggregation proofs in real-time. If `start_epoch` is provided, sends historical data first. ### Method POST ### Endpoint /api/v1/ListenProofs ### Request Body - **startEpoch** (integer) - Optional - The epoch from which to start streaming historical data. ### Request Example ```json { "startEpoch": 12000 } ``` ### Response (Stream of proofs) #### Success Response (200) - **proof** (string) - An aggregation proof event. #### Response Example ```json { "proof": "new_proof_data" } ``` ``` -------------------------------- ### Stream Validator Set Changes using HTTP/JSON REST API Source: https://context7.com/symbioticfi/relay/llms.txt This example shows how to stream validator set changes in real-time using the HTTP/JSON REST API, leveraging Server-Sent Events. It makes a curl request to the specified endpoint with a starting epoch. The server responds with data events containing validator set information. ```bash # Using HTTP/JSON REST API (Server-Sent Events via HTTP gateway) curl http://localhost:8080/v1/stream/validator-set?start_epoch=100 # Streams responses like: # data: {"validator_set":{"version":1,"epoch":100,...}} # data: {"validator_set":{"version":1,"epoch":101,...}} ``` -------------------------------- ### Get Signature Request API Source: https://context7.com/symbioticfi/relay/llms.txt Retrieve detailed information about a specific signature request by its ID. Use this to get specifics about a single request. ```APIDOC ## GET /v1/signature-request/{request_id} ### Description Retrieve detailed information about a specific signature request by its ID. Use this to get specifics about a single request. ### Method GET ### Endpoint /v1/signature-request/{request_id} ### Parameters #### Path Parameters - **request_id** (string) - Required - The ID of the signature request to retrieve. ### Response #### Success Response (200) - **signature_request** (object) - The signature request object. - **request_id** (string) - The unique identifier for the signature request. - **key_tag** (integer) - The tag associated with the key used for the request. - **message** (string) - The base64 encoded message for the signature request. - **required_epoch** (integer) - The epoch in which this signature request was required. #### Response Example ```json { "signature_request": { "request_id": "0x1234567890abcdef", "key_tag": 15, "message": "SGVsbG8sIFN5bWJpb3RpYyE=", "required_epoch": 100 } } ``` ``` -------------------------------- ### Building Relay Sidecar Docker Image (Bash) Source: https://github.com/symbioticfi/relay/blob/dev/DEVELOPMENT.md Provides the `make` commands for building the relay sidecar Docker image. It includes a basic command and an advanced command for building and pushing multi-architecture images with specific flags. ```bash make image # To build and push multi-architecture images: PUSH_IMAGE=true PUSH_LATEST=true make image ``` -------------------------------- ### GET /v1/signatures/{request_id} - Get Signatures Source: https://context7.com/symbioticfi/relay/llms.txt Retrieve individual validator signatures associated with a specific signing request. This endpoint allows inspection of the underlying signatures before aggregation. ```APIDOC ## GET /v1/signatures/{request_id} ### Description Retrieve individual validator signatures for a specific signing request. ### Method GET ### Endpoint /v1/signatures/{request_id} ### Parameters #### Path Parameters - **request_id** (string) - Required - The ID of the signing request for which to retrieve signatures. ### Response #### Success Response (200) - **signatures** (array) - A list of individual signatures. - Each element is an object with: - **signature** (string) - The validator's signature. - **message_hash** (string) - The hash of the message that was signed. - **public_key** (string) - The public key of the validator who provided the signature. - **request_id** (string) - The ID of the signing request. #### Response Example ```json { "signatures": [ { "signature": "0xabc...", "message_hash": "0xdef...", "public_key": "0x123...", "request_id": "0x1234567890abcdef" } ] } ``` ``` -------------------------------- ### GET /v1/aggregation/proof/{request_id} - Get Aggregation Proof Source: https://context7.com/symbioticfi/relay/llms.txt Retrieve the aggregated signature proof for a specific signing request using its unique request ID. This proof can be used for cross-chain verification or other coordination tasks. ```APIDOC ## GET /v1/aggregation/proof/{request_id} ### Description Retrieve the aggregated signature proof for a completed signing request using its request ID. ### Method GET ### Endpoint /v1/aggregation/proof/{request_id} ### Parameters #### Path Parameters - **request_id** (string) - Required - The ID of the signing request for which to retrieve the aggregation proof. ### Response #### Success Response (200) - **aggregation_proof** (object) - Contains the aggregated proof details. - **message_hash** (string) - The hash of the original message that was signed. - **proof** (string) - The aggregated signature proof (e.g., BLS signature or ZKP). - **request_id** (string) - The ID of the signing request. #### Response Example ```json { "aggregation_proof": { "message_hash": "0xabcdef...", "proof": "0x123456...", "request_id": "0x1234567890abcdef" } } ``` ``` -------------------------------- ### Error Wrapping with Stacktrace Capture (Go) Source: https://github.com/symbioticfi/relay/blob/dev/DEVELOPMENT.md Demonstrates how to wrap errors using the 'go-errors/errors' package in Go. This preserves the stack trace at the point of error, providing more context for debugging. It's recommended for internal function error handling. ```go import "github.com/go-errors/errors" func (s *Service) loadData(id string) error { data, err := s.repo.Get(id) if err != nil { // Wrap with context, preserve stack trace return errors.Errorf("failed to load data for id=%s: %w", id, err) } return nil } ``` -------------------------------- ### GET /v1/aggregation/proofs/epoch/{epoch} - Get Aggregation Proofs by Epoch Source: https://context7.com/symbioticfi/relay/llms.txt Fetch all aggregated signature proofs that were generated within a specified epoch. This is useful for auditing or retrieving batches of proofs related to a particular time frame. ```APIDOC ## GET /v1/aggregation/proofs/epoch/{epoch} ### Description Retrieve all aggregation proofs generated during a specific epoch. ### Method GET ### Endpoint /v1/aggregation/proofs/epoch/{epoch} ### Parameters #### Path Parameters - **epoch** (integer) - Required - The epoch number for which to retrieve aggregation proofs. ### Response #### Success Response (200) - **aggregation_proofs** (array) - A list of aggregation proofs. - Each element is an object with: - **message_hash** (string) - The hash of the original message. - **proof** (string) - The aggregated signature proof. - **request_id** (string) - The ID of the signing request. #### Response Example ```json { "aggregation_proofs": [ { "message_hash": "0xabcdef...", "proof": "0x123456...", "request_id": "0x1234567890abcdef" } ] } ``` ``` -------------------------------- ### Regenerate Go Code and Docs from Proto Definition Source: https://github.com/symbioticfi/relay/blob/dev/DEVELOPMENT.md Executes the 'make generate' command to regenerate Go code and documentation based on changes made to the API proto file (`api/proto/v1/api.proto`). This is a crucial step after updating API definitions. ```bash make generate ``` -------------------------------- ### GetValidatorSetMetadataRequest Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/doc.md Request to get metadata for the validator set. ```APIDOC ## GetValidatorSetMetadataRequest Request message for getting validator set metadata. ### Fields - **epoch** (uint64) - Optional - The epoch number. If not provided, the current epoch is used. ``` -------------------------------- ### Download and Run Pre-built Relay Binaries (macOS ARM64) Source: https://github.com/symbioticfi/relay/blob/dev/README.md These commands download the latest pre-built `relay_sidecar` and `relay_utils` binaries for macOS ARM64 from GitHub releases. It then makes them executable and provides an example of how to run the `relay_sidecar` with a configuration file. ```bash # macOS ARM64 wget https://github.com/symbioticfi/relay/releases/latest/download/relay_sidecar_darwin_arm64 wget https://github.com/symbioticfi/relay/releases/latest/download/relay_utils_darwin_arm64 chmod +x relay_sidecar_darwin_arm64 relay_utils_darwin_arm64 # Run the binaries ./relay_sidecar_darwin_arm64 --config config.yaml ``` -------------------------------- ### Download and Run Pre-built Relay Binaries (Linux AMD64) Source: https://github.com/symbioticfi/relay/blob/dev/README.md These commands download the latest pre-built `relay_sidecar` and `relay_utils` binaries for Linux AMD64 from GitHub releases. It then makes them executable and provides an example of how to run the `relay_sidecar` with a configuration file. ```bash # Download the latest release for your platform # Linux AMD64 wget https://github.com/symbioticfi/relay/releases/latest/download/relay_sidecar_linux_amd64 wget https://github.com/symbioticfi/relay/releases/latest/download/relay_utils_linux_amd64 chmod +x relay_sidecar_linux_amd64 relay_utils_linux_amd64 # Run the binaries ./relay_sidecar_linux_amd64 --config config.yaml ``` -------------------------------- ### GetValidatorByAddressRequest Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/doc.md Request to get validator information by their address. ```APIDOC ## GetValidatorByAddressRequest Request message for getting validator information by address. ### Fields - **address** (string) - Required - The address of the validator. ``` -------------------------------- ### GetLocalValidatorRequest Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/doc.md Request to get information about the local validator. ```APIDOC ## GetLocalValidatorRequest Request message for getting information about the local validator. ### Fields - (No fields - this is a simple request for local validator data) ``` -------------------------------- ### Log Message Formatting Conventions (Go) Source: https://github.com/symbioticfi/relay/blob/dev/DEVELOPMENT.md Provides guidelines for writing log messages in Go, emphasizing the use of past tense verbs for completed actions. It also highlights acceptable variations for long-running operations and specifies consistent terminology for different event types. ```go // ✅ Correct: Past tense verbs indicating completed actions slog.InfoContext(ctx, "Signature received") slog.InfoContext(ctx, "Validator set loaded") slog.InfoContext(ctx, "Proof submitted to chain") slog.DebugContext(ctx, "Checked for missing epochs") // ❌ Incorrect slog.InfoContext(ctx, "Receiving signature") // present continuous slog.InfoContext(ctx, "Load validator set") // imperative slog.InfoContext(ctx, "Signature receive") // noun only // ✅ Acceptable for long-running operations slog.DebugContext(ctx, "Aggregating signatures from validators", "count", validatorCount) // ... long operation ... slog.InfoContext(ctx, "Aggregation completed", "duration", time.Since(start)) ``` -------------------------------- ### Listen to Aggregation Proofs Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/doc.md Streams aggregation proofs. ```APIDOC ## POST /symbioticfi/relay/v1/ListenProofs ### Description Establishes a stream to listen for aggregation proofs. You can optionally specify a `start_epoch` to receive historical proofs from that epoch onwards, followed by real-time updates. If `start_epoch` is omitted, only proofs generated after the stream is created will be sent. ### Method POST ### Endpoint `/symbioticfi/relay/v1/ListenProofs` ### Parameters #### Request Body - **start_epoch** (uint64) - Optional - The epoch from which to start streaming historical proofs. If not provided, only real-time updates are sent. ### Request Example ```json { "start_epoch": 12345 } ``` ### Response #### Success Response (200) - **request_id** (string) - The ID of the request associated with the proof. - **epoch** (uint64) - The epoch number to which the proof pertains. - **aggregation_proof** (AggregationProof) - The aggregation proof data. #### Response Example ```json { "request_id": "some-proof-request-id", "epoch": 12345, "aggregation_proof": { "data": "0x..." } } ``` ``` -------------------------------- ### GetCurrentEpochRequest Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/doc.md Request to get the current epoch information. ```APIDOC ## GetCurrentEpochRequest Request message for getting the current epoch information. ### Fields - (No fields - this is a simple request for current data) ``` -------------------------------- ### GetAggregationStatusRequest Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/doc.md Request to get the status of an aggregation job. ```APIDOC ## GetAggregationStatusRequest Request message for getting the status of an aggregation job. ### Fields - **request_id** (string) - Required - The ID of the aggregation request. ``` -------------------------------- ### ListenSignatures Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/index.html Streams signatures in real-time. If `start_epoch` is provided, historical data is sent first. ```APIDOC ## POST /api/v1/ListenSignatures ### Description Streams signatures in real-time. If `start_epoch` is provided, sends historical data first. ### Method POST ### Endpoint /api/v1/ListenSignatures ### Request Body - **startEpoch** (integer) - Optional - The epoch from which to start streaming historical data. ### Request Example ```json { "startEpoch": 12000 } ``` ### Response (Stream of signatures) #### Success Response (200) - **signature** (string) - A signature event. #### Response Example ```json { "signature": "new_signature_data" } ``` ``` -------------------------------- ### Get Validator Set Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/doc.md Retrieves the current validator set. ```APIDOC ## GET /symbioticfi/relay/v1/GetValidatorSet ### Description Retrieves the current validator set. If an epoch is specified, it returns the validator set for that epoch. Otherwise, it defaults to the latest committed epoch. ### Method GET ### Endpoint `/symbioticfi/relay/v1/GetValidatorSet` ### Parameters #### Query Parameters - **epoch** (uint64) - Optional - Epoch number for which to retrieve the validator set. If not provided, the current epoch is used. ### Response #### Success Response (200) - **validator_set** (ValidatorSet) - The validator set for the specified or current epoch. #### Response Example ```json { "validator_set": { "validators": [ { "address": "0x...", "total_stake": "1000000" } ], "total_stake": "10000000" } } ``` ``` -------------------------------- ### Listen for Aggregation Proofs using Go gRPC Source: https://context7.com/symbioticfi/relay/llms.txt This Go code snippet demonstrates how to connect to the relay service using gRPC and listen for new aggregation proofs starting from a specified epoch. It handles stream reception and logs details of each received proof. Dependencies include the gRPC client library and the relay's protobuf definitions. ```go // Using Go gRPC client epoch := uint64(100) stream, err := c.ListenProofs(ctx, &client.ListenProofsRequest{ StartEpoch: &epoch, }) if err != nil { log.Fatalf("ListenProofs failed: %v", err) } for { resp, err := stream.Recv() if err != nil { log.Printf("Stream ended: %v", err) break } log.Printf("New aggregation proof received:") log.Printf(" Request ID: %s", resp.RequestId) log.Printf(" Epoch: %d", resp.Epoch) if resp.AggregationProof != nil { log.Printf(" Proof: %x", resp.AggregationProof.Proof) log.Printf(" Message Hash: %x", resp.AggregationProof.MessageHash) } } ``` -------------------------------- ### GetValidatorSetRequest Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/doc.md Request to get the validator set for a specific epoch. ```APIDOC ## GetValidatorSetRequest Request message for retrieving the validator set. ### Fields - **epoch** (uint64) - Optional - The epoch number. If not provided, the current epoch is used. ``` -------------------------------- ### ListenProofsRequest Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/doc.md Request to listen for new aggregation proofs. ```APIDOC ## ListenProofsRequest Request message for subscribing to new aggregation proofs. ### Fields - (No fields - this is a subscription request) ``` -------------------------------- ### GetValidatorByKeyRequest Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/doc.md Request to get validator information by their public key. ```APIDOC ## GetValidatorByKeyRequest Request message for getting validator information by public key. ### Fields - **public_key** (string) - Required - The public key of the validator. ``` -------------------------------- ### Network Configuration for Quorum Thresholds (Go) Source: https://github.com/symbioticfi/relay/blob/dev/docs/core/keys_and_quorum.md Illustrates the Go structures for configuring network-wide quorum thresholds and required key tags. This allows setting specific voting power percentages for different key tags. ```go type QuorumThreshold struct { KeyTag KeyTag // Key tag this threshold applies to QuorumThreshold QuorumThresholdPct // Threshold as percentage (0-10^18) } type NetworkConfig struct { // ... other fields ... QuorumThresholds []QuorumThreshold // Multiple thresholds per key tag RequiredKeyTags []KeyTag // Key tags validators must have RequiredHeaderKeyTag KeyTag // Key tag for valset header commitments } ``` -------------------------------- ### GetLastCommittedRequest Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/doc.md Request to get information about the last committed data. ```APIDOC ## GetLastCommittedRequest Request message for getting information about the last committed data. ### Fields - (No fields - this is a simple request for current data) ``` -------------------------------- ### GetCustomScheduleNodeStatusRequest Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/doc.md Request to get the status of a custom schedule node. ```APIDOC ## GetCustomScheduleNodeStatusRequest Request message for getting the status of a custom schedule node. ### Fields - **node_id** (string) - Required - The ID of the custom schedule node. ``` -------------------------------- ### Configure Relay Network Environment Variables Source: https://github.com/symbioticfi/relay/blob/dev/DEVELOPMENT.md Sets environment variables to configure the number of operator, committer, and aggregator nodes, as well as verification type, epoch duration, block time, and finality blocks for the relay network. ```bash # Configure network before setup export OPERATORS=6 # Number of relay operator nodes (default: 4) export COMMITERS=2 # Number of committer nodes (default: 1) export AGGREGATORS=1 # Number of aggregator nodes (default: 1) export VERIFICATION_TYPE=1 # 0=ZK proofs, 1=BLS simple (default: 1) export EPOCH_TIME=30 # Epoch duration in seconds (default: 30) export BLOCK_TIME=2 # Block time in seconds (default: 1) export FINALITY_BLOCKS=2 # Blocks until finality (default: 2) # Run setup with custom config cd e2e ./setup.sh ``` -------------------------------- ### GetAggregationProofsByEpoch Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/doc.md Retrieves all aggregation proofs for a specific epoch. ```APIDOC ## GetAggregationProofsByEpoch ### Description Fetches all aggregation proofs associated with a given epoch number. ### Method GET ### Endpoint /aggregation/proofs/epoch ### Parameters #### Query Parameters - **epoch** (uint64) - Required - The epoch number for which to retrieve aggregation proofs. ### Request Example ```json { "epoch": 12345 } ``` ### Response #### Success Response (200) - **aggregation_proofs** (AggregationProof, repeated) - A list of aggregation proofs for the specified epoch. #### Response Example ```json { "aggregation_proofs": [ { "key": "bytes-key-1", "value": "bytes-value-1" }, { "key": "bytes-key-2", "value": "bytes-value-2" } ] } ``` ``` -------------------------------- ### GetValidatorSetHeaderRequest Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/doc.md Request to get the header of the validator set for a specific epoch. ```APIDOC ## GetValidatorSetHeaderRequest Request message for getting the validator set header. ### Fields - **epoch** (uint64) - Optional - The epoch number. If not provided, the current epoch is used. ``` -------------------------------- ### GetSignatureRequestIDsByEpochRequest Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/doc.md Request to get the IDs of signature requests for a specific epoch. ```APIDOC ## GetSignatureRequestIDsByEpochRequest Request message for getting signature request IDs by epoch. ### Fields - **epoch** (uint64) - Required - The epoch number. ``` -------------------------------- ### Listen to Signatures Stream Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/index.html Provides a real-time stream of signatures. Can be initiated from a specific epoch to include past signatures before transitioning to live updates. ```APIDOC ## POST /symbioticfi/relay/ListenSignatures ### Description Listens for a stream of signatures. ### Method POST ### Endpoint /symbioticfi/relay/ListenSignatures ### Parameters #### Request Body - **start_epoch** (uint64) - Optional - If provided, the stream will include historical signatures starting from this epoch. If not provided, only new signatures will be sent. ### Response #### Success Response (200 - Stream) - **request_id** (string) - The ID of the request. - **epoch** (uint64) - The epoch number for the signature. - **signature** (Signature) - The signature data. #### Response Example (for each stream message) { "request_id": "stream-xyz", "epoch": 102, "signature": { "signature": "0x...", "signer": "0x..." } } ``` -------------------------------- ### Listen to Signatures Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/doc.md Streams signatures. ```APIDOC ## POST /symbioticfi/relay/v1/ListenSignatures ### Description Establishes a stream to listen for signatures. You can optionally specify a `start_epoch` to receive historical signatures from that epoch onwards, followed by real-time updates. If `start_epoch` is omitted, only signatures generated after the stream is created will be sent. ### Method POST ### Endpoint `/symbioticfi/relay/v1/ListenSignatures` ### Parameters #### Request Body - **start_epoch** (uint64) - Optional - The epoch from which to start streaming historical signatures. If not provided, only real-time updates are sent. ### Request Example ```json { "start_epoch": 12345 } ``` ### Response #### Success Response (200) - **request_id** (string) - The ID of the signature request. - **epoch** (uint64) - The epoch number to which the signature pertains. - **signature** (Signature) - The signature data. #### Response Example ```json { "request_id": "some-signature-request-id", "epoch": 12345, "signature": { "signature": "0x...", "message_hash": "0x...", "public_key": "0x...", "request_id": "original-request-id" } } ``` ``` -------------------------------- ### GetLastAllCommittedRequest Source: https://github.com/symbioticfi/relay/blob/dev/docs/api/v1/doc.md Request to get information about all committed data up to the latest epoch. ```APIDOC ## GetLastAllCommittedRequest Request message for getting information about all committed data up to the latest epoch. ### Fields - (No fields - this is a simple request for current data) ``` -------------------------------- ### Update Cosmos Relay SDK Client Package Source: https://github.com/symbioticfi/relay/blob/dev/DEVELOPMENT.md Updates the Go client package for the cosmos-relay-sdk to the latest version and tidies the Go module dependencies. This ensures the relay uses the most recent client interface for interacting with Cosmos SDK chains. ```bash go get github.com/symbioticfi/relay/api/client/v1@latest go mod tidy ```