> For the complete documentation index, see [llms.txt](https://docs.bloxroute.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bloxroute.com/base/streams/flashblocks.md).

# Flashblocks

`GetBdnFlashBlockStream` feed provides low-latency access to newly produced **Flashblocks** on the Base network. Flashblocks are pre-confirmation blocks available before they are finalized on-chain and may differ from the final canonical chain. This is a real-time WS/gRPC, raw Flashblocks data stream.

**Service available via Cloud API only.**

## Stream Endpoint

* Method: `GetBdnFlashBlockStream`
* Endpoint: `wss://base.blxrbdn.com:5005/ws`

## Examples

{% tabs %}
{% tab title="WebSocket" %}

```shellscript
wscat -H "Authorization: <AUTH_HEADER>" \
  -c wss://base.blxrbdn.com:5005/ws \
  --wait 1000 \
  --execute '{"jsonrpc": "2.0", "id": 1, "method": "subscribe", "params": [  "GetBdnFlashBlockStream", {} ]}'
```

{% endtab %}

{% tab title="gRPC" %}

```shellscript
grpcurl -H "Authorization: <AUTH_HEADER>" \
  -H "Content-Type: application/grpc" \
  -d '{}' \
  base.blxrbdn.com:443 \
  streamerapi.Api/GetBdnFlashBlockStream
```

{% endtab %}

{% tab title="Golang" %}

```go
package main

import (
	"encoding/json"
	"net/http"
	"net/url"

	"github.com/gorilla/websocket"
	"github.com/rs/zerolog/log"
)

const (
	BxAuthHeader = "PUT_YOUR_AUTH_HEADER"
)

type Result struct {
	BdnFlashBlock []byte `json:"bdnFlashBlock"`
}

type Params struct {
	Subscription string `json:"subscription"`
	Result       Result `json:"result"`
}

type Response struct {
	JsonRPC string `json:"jsonrpc"`
	Method  string `json:"method"`
	Params  Params `json:"params"`
}

func main() {
	u, err := url.Parse("wss://base.blxrbdn.com:5005/ws")
	if err != nil {
		log.Fatal().Err(err).Msg("Invalid WebSocket URL: ")
	}

	log.Info().Str("url", u.String()).Msg("Connecting...")
	conn, _, err := websocket.DefaultDialer.Dial(u.String(), http.Header{
		"Authorization": []string{BxAuthHeader},
	})
	if err != nil {
		log.Fatal().Err(err).Msg("WebSocket connection failed: ")
	}
	defer conn.Close()

	request := []byte(`{"jsonrpc": "2.0", "id": 1, "method": "subscribe", "params": [ "GetBdnFlashBlockStream", {} ]}`)
	err = conn.WriteMessage(websocket.TextMessage, request)
	if err != nil {
		log.Fatal().Err(err).Msg("Error sending message: ")
	}

	log.Info().Msg("Connected! Listening for Flashblocks...")
	for {
		msgType, msg, err := conn.ReadMessage()
		if err != nil {
			log.Error().Err(err).Msg("Read error: ")
			continue
		}

		if msgType != websocket.TextMessage {
			log.Error().Err(err).Int("msgType", msgType).Msg("Skipping non-text message: ")
			continue
		}

		var response *Response
		err = json.Unmarshal(msg, &response)
		if err != nil {
			log.Error().Err(err).Msg("Failed to unmarshal response: ")
			continue
		}

		if response.Params.Result.BdnFlashBlock == nil { // Expected for the first update
			log.Warn().Msg("BdnFlashBlock is nil")
			continue
		}

		// Use the Brotli-compressed Flashblock...
		log.Info().Msg("Got Flashblock")
	}
}
```

{% endtab %}
{% endtabs %}

## Response<br>

{% tabs %}
{% tab title="WebSocket" %}

```json
{"jsonrpc":"2.0",
"method":"subscribe",
"params":{"subscription":"43dcfff5-e67a-44ee-9284-85b8add00db5",
"result":{"bdnFlashBlock":
"G80JAGS//cKU/7oQmkmm+sABKdoXLMEWDuf/cIHFCaYxxX+09qS5KYt7YZTNcQv3dDrAs7lEL8uy51xSKyicwKfZk/x7vfO/X731uj2v68kFfwGTEOucxaeO1PXgUuq6nsCDS6foejIPEppzcyX7ppp1sy6SEljbItbg96xWK6Q5pixrRtHs5MTdqRN8CpJ5F6ZIDYm3a0RfD3RAgiGxH86op3NNklpN+wo9JJ5q4pO0EmR7ctHU1LIlZ5oMfDb6kbObfbpv9EAflsSPwjoR4prmfOjPtw/+pvxt+/BM27V6h4nFbENOXkDSp2M0B1FFFGKsGhjlmGocYuAS3S0NGw67BMkNIZ08slzzU7/f6IbG1uFeDpFwPbiONXqT7WOnZw+iGvv2UBL2IwfXL9XaSPnek6lNTCD0J+tmmch3/eH21O8KoaVT9/X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C1eoFR5w4O8yg8vruKQgjyWVqZ6Eh+l66TLrl0QJoULd7s2b2qxr4iY8QwGO5O10CfPVGTtws6HWek7w59HxmlAk3B8NVsHDRKB2RJWeojW54EAqSZJP....3....B"}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.bloxroute.com/base/streams/flashblocks.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
