> ## Documentation Index
> Fetch the complete documentation index at: https://docs.solanatracker.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication & Setup

> Get your Solana Tracker Yellowstone gRPC credentials, configure your client with x-token authentication, and connect to the streaming endpoint.

## Getting Your API Key

<Steps>
  <Step title="Subscribe to Service">
    Subscribe to the gRPC service at **\$247/month** to get access to:

    * EU endpoint: `https://grpc.solanatracker.io`
    * US endpoint: `https://grpc-us.solanatracker.io`
    * Accelerated by Jito Shreds
    * No bandwidth charges
  </Step>

  <Step title="Receive Credentials">
    After subscription, you'll receive:

    * Your API token
    * Endpoint URLs
    * Configuration guidelines
  </Step>

  <Step title="Test Connection">
    Verify your credentials work by creating a simple test connection
  </Step>
</Steps>

## Authentication Methods

### Header-Based Authentication

Add your API token to the request headers:

<ParamField header="x-token" type="string" required>
  Your API token for authenticating gRPC requests
</ParamField>

## Client Configuration

### TypeScript/JavaScript

```bash theme={null}
npm install @triton-one/yellowstone-grpc
```

```typescript theme={null}
import Client from "@triton-one/yellowstone-grpc";

const client = new Client(
  "https://grpc.solanatracker.io",  // or https://grpc-us.solanatracker.io
  "your-api-token",
  {
    // Recommended settings
    "grpc.max_receive_message_length": 64 * 1024 * 1024,  // 64MB
    "grpc.max_send_message_length": 64 * 1024 * 1024,     // 64MB
    "grpc.keepalive_time_ms": 30000,                      // 30 seconds
    "grpc.keepalive_timeout_ms": 5000,                    // 5 seconds
  }
);
```

### Rust

```toml theme={null}
[dependencies]
yellowstone-grpc-client = "9.0.1"
yellowstone-grpc-proto = "9.0.1"
tokio = { version = "1.0", features = ["full"] }
tonic = "0.10"
```

```rust theme={null}
use yellowstone_grpc_client::GeyserGrpcClient;
use std::time::Duration;

let endpoint = "https://grpc.solanatracker.io";
let token = Some("your-api-token".to_string());

let client = GeyserGrpcClient::build_from_shared(endpoint)?
    .x_token(token)?
    .connect_timeout(Duration::from_secs(10))
    .timeout(Duration::from_secs(10))
    .max_decoding_message_size(64 * 1024 * 1024)
    .connect()
    .await?;
```

### Go

```bash theme={null}
go get github.com/rpcpool/yellowstone-grpc/examples/golang@latest
go get google.golang.org/grpc@v1.67.1
```

```go theme={null}
import (
    "google.golang.org/grpc"
    "google.golang.org/grpc/metadata"
)

conn, err := grpc.Dial(
    "grpc.solanatracker.io:443",
    grpc.WithTransportCredentials(credentials.NewClientTLSFromCert(nil, "")),
    grpc.WithDefaultCallOptions(
        grpc.MaxCallRecvMsgSize(64 * 1024 * 1024),
        grpc.MaxCallSendMsgSize(64 * 1024 * 1024),
    ),
)

// Add authentication
ctx := metadata.AppendToOutgoingContext(context.Background(), "x-token", "your-api-token")
```

## Endpoint Selection

Choose the endpoint that provides the best latency for your infrastructure:

<CardGroup cols={2}>
  <Card title="Primary Endpoint" icon="globe">
    **[https://grpc.solanatracker.io](https://grpc.solanatracker.io)**

    * Best for global applications
    * Automatic routing
    * High availability
  </Card>

  <Card title="US Endpoint" icon="location-dot">
    **[https://grpc-us.solanatracker.io](https://grpc-us.solanatracker.io)**

    * Optimized for North America
    * Lower latency for US-based apps
    * Direct US routing
  </Card>
</CardGroup>

<Tip>
  Test both endpoints and use the one with lower latency from your deployment region.
</Tip>

## Configuration Best Practices

### Message Size Limits

Set appropriate message size limits to handle large blocks and transaction batches:

```typescript theme={null}
{
  "grpc.max_receive_message_length": 64 * 1024 * 1024,  // 64MB
  "grpc.max_send_message_length": 64 * 1024 * 1024      // 64MB
}
```

### Keepalive Settings

Configure keepalive to maintain persistent connections:

```typescript theme={null}
{
  "grpc.keepalive_time_ms": 30000,        // Send keepalive every 30s
  "grpc.keepalive_timeout_ms": 5000,      // Wait 5s for keepalive response
  "grpc.keepalive_permit_without_calls": 1 // Allow keepalive without active calls
}
```

### Connection Timeouts

Set reasonable timeout values:

```typescript theme={null}
{
  "grpc.initial_reconnect_backoff_ms": 1000,  // Start with 1s backoff
  "grpc.max_reconnect_backoff_ms": 30000,     // Max 30s backoff
  "grpc.min_reconnect_backoff_ms": 1000       // Min 1s backoff
}
```

## Testing Your Connection

Create a simple test to verify your setup:

```typescript theme={null}
import Client, { CommitmentLevel } from "@triton-one/yellowstone-grpc";

async function testConnection() {
  const client = new Client(
    "https://grpc.solanatracker.io",
    "your-api-token",
    {
      "grpc.max_receive_message_length": 64 * 1024 * 1024
    }
  );

  try {
    const stream = await client.subscribe();
    
    stream.on("data", (data) => {
      console.log("Connection successful! Received data:", data);
      stream.end();
      client.close();
      process.exit(0);
    });

    stream.on("error", (error) => {
      console.error("Connection error:", error);
      process.exit(1);
    });

    // Subscribe to slot updates (lightweight test)
    const request = {
      slots: { slotSubscribe: {} },
      commitment: CommitmentLevel.CONFIRMED
    };

    stream.write(request);

    console.log("Testing connection...");
  } catch (error) {
    console.error("Failed to connect:", error);
    process.exit(1);
  }
}

testConnection();
```

## Troubleshooting

<Accordion title="Authentication Failed">
  **Error:** `UNAUTHENTICATED` or `Invalid token`

  **Solutions:**

  * Verify your API token is correct
  * Check token is properly set in headers
  * Ensure subscription is active
</Accordion>

<Accordion title="Connection Timeout">
  **Error:** Connection times out or fails to establish

  **Solutions:**

  * Verify endpoint URL is correct (include `https://`)
  * Check firewall allows outbound gRPC connections
  * Try alternative endpoint
  * Increase connection timeout settings
</Accordion>

<Accordion title="Message Size Errors">
  **Error:** `RESOURCE_EXHAUSTED` or message size errors

  **Solutions:**

  * Increase `max_receive_message_length` to 64MB
  * Increase `max_send_message_length` to 64MB
  * Use data slicing to reduce message sizes
  * Apply more specific filters
</Accordion>

## Security Best Practices

<Warning>
  **Protect Your API Token**

  * Never commit tokens to version control
  * Use environment variables for tokens
  * Rotate tokens periodically
  * Implement token management system
</Warning>

### Environment Variables

Store your credentials securely:

```bash theme={null}
# .env file
GRPC_ENDPOINT=https://grpc.solanatracker.io
GRPC_API_TOKEN=your-api-token
```

```typescript theme={null}
import * as dotenv from 'dotenv';
dotenv.config();

const client = new Client(
  process.env.GRPC_ENDPOINT!,
  process.env.GRPC_API_TOKEN!,
  { /* ... */ }
);
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Quickstart Guide" icon="rocket" href="/yellowstone-grpc/quickstart">
    Build your first streaming application
  </Card>

  <Card title="Account Monitoring" icon="user" href="/yellowstone-grpc/account-monitoring">
    Learn to monitor account changes
  </Card>
</CardGroup>
