What you’ll need
Before connecting, make sure you have:
- The appropriate language SDK installed (Go, Rust, or TypeScript)
- The Protochain server endpoint (host and port) for your environment
- Clarity on whether your environment requires TLS — local development typically uses plaintext; production environments require TLS
Connection setup
Switching services
Each Protochain service has its own generated client stub. To use a different service, import that service’s package and instantiate its client. In Go, you can reuse the sameconn across multiple stubs — opening one channel and sharing it is more efficient than creating a channel per service. In Rust and TypeScript, call .connect() or instantiate a new client for each service.
Import paths by language:
- Go:
github.com/meshtrade/protochain/lib/go/protochain/solana/[service]/v1 - Rust:
protochain::solana::[service]::v1::service_client::ServiceClient - TypeScript:
@protochain/solana-[service]-v1
[service] with the service name: account, transaction, system_program, token_program, or rpc_client.
TLS and credentials
The examples above use plaintext connections (no TLS), which is appropriate for local development. For production environments:- Go: Replace
insecure.NewCredentials()with your TLS credentials (e.g.,credentials.NewTLS(&tls.Config{})) - Rust: Replace
http://withhttps://in the endpoint URL - TypeScript: Replace
credentials.createInsecure()withcredentials.createSsl()
Once connected, follow the Quickstart to make your first API calls.