Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Symbiotic Relay Client Examples

This directory contains example code demonstrating how to use the Symbiotic Relay Go client library to interact with a Symbiotic Relay server.

Basic Usage Example

The example shows how to:

  1. Connect to a Symbiotic Relay server
  2. Get current epoch information
  3. Sign messages
  4. Retrieve aggregation proofs and signatures
  5. Get validator set information
  6. Use streaming responses for real-time updates

Prerequisites

Before running the examples, ensure you have:

  • Go 1.26 or later installed
  • Access to a running Symbiotic Relay Network
  • Network connectivity to the relay server
  • Valid key configurations on the relay server (for signing operations)

Running the Example

cd api/client/examples
go run main.go

By default, the example will try to connect to localhost:8080. You can specify a different server URL by setting the RELAY_SERVER_URL environment variable:

RELAY_SERVER_URL=my-relay-server:8081 go run main.go

NOTE: for the signature/proof generation to work you need to run the script for all active relay servers to get the majority consensus to generate proof.

Integration with Your Application

To integrate this client into your own application:

  1. Import the client package:

    import client "github.com/symbioticfi/relay/api/client/v1"
  2. Create a connection:

    conn, err := grpc.Dial(serverURL, grpc.WithTransportCredentials(insecure.NewCredentials()))
    if err != nil {
        return err
    }
    client := client.NewSymbioticClient(conn)
  3. Use the client methods as demonstrated in the example

  4. Handle errors appropriately for your use case

  5. Ensure proper connection cleanup with defer conn.Close()

More Examples

For a more comprehensive example of using the client library in a real-world application, see:

API Reference

For complete API documentation, refer to:

License

This client library and example code are licensed under the MIT License. See the LICENSE file for details.