This directory contains example code demonstrating how to use the Symbiotic Relay Go client library to interact with a Symbiotic Relay server.
The example shows how to:
- Connect to a Symbiotic Relay server
- Get current epoch information
- Sign messages
- Retrieve aggregation proofs and signatures
- Get validator set information
- Use streaming responses for real-time updates
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)
cd api/client/examples
go run main.goBy 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.goNOTE: 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.
To integrate this client into your own application:
-
Import the client package:
import client "github.com/symbioticfi/relay/api/client/v1"
-
Create a connection:
conn, err := grpc.Dial(serverURL, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { return err } client := client.NewSymbioticClient(conn)
-
Use the client methods as demonstrated in the example
-
Handle errors appropriately for your use case
-
Ensure proper connection cleanup with
defer conn.Close()
For a more comprehensive example of using the client library in a real-world application, see:
For complete API documentation, refer to:
- API Documentation:
docs/api/v1/doc.md - Protocol Buffer definitions:
api/proto/v1/api.proto - Generated Go types:
api/client/v1/types.go - Client interface:
api/client/v1/client.go
This client library and example code are licensed under the MIT License. See the LICENSE file for details.