# Gateway API

The **Gateway API** connects your local blockchain node to the bloXroute BDN via a bloXroute Gateway. This setup offers the **lowest-latency** access to the network and is ideal for latency-sensitive applications such as trading bots or validator nodes.

#### **Why Use the Gateway API?**

* **Private connection** to the BDN
* **Fastest propagation** of blocks and transactions
* **Full control** over node and Gateway placement

#### **How It Works**

* The Gateway sits alongside your full node (e.g., Geth, Erigon, BSC node).
* It peers with the node using the native protocol (e.g., Ethereum's devp2p).
* The Gateway connects to bloXroute’s global Relay network for fast propagation.
* You send and receive data through the Gateway’s local WebSocket interface.

#### **Recommended: gRPC Streaming**

To ensure high performance, use **gRPC** for subscriptions:

* Supported on Gateways with `--grpc` flag.
* TLS is required for secure connections.

**Enable TLS in Go**

```go
creds := credentials.NewClientTLSFromCert(nil, "")
conn, err := grpc.Dial(url, grpc.WithTransportCredentials(creds))
```

**Using the bloXroute SDK**

```go
creds := credentials.NewClientTLSFromCert(nil, "")

config := &sdk.Config{
    AuthHeader: "<header>",
    GRPCGatewayURL: "virginia.eth.blxrbdn.com:5005",
    GRPCDialOptions: []grpc.DialOption{grpc.WithTransportCredentials(creds)},
}

c, err := sdk.NewClient(context.Background(), config)
```
