# 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)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bloxroute.com/core-solutions/accessing-the-bdn/gateway-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
