Real-time NEAR blocks

Server-Sent Events stream for NEAR blocks. Free hosted service with automatic catch-up, resume support, and finality guarantees.

Live Stream

Connecting to stream...

Quick Start

cURL
curl -N https://live.near.tools
JavaScript / TypeScript
const eventSource = new EventSource("https://live.near.tools")

eventSource.addEventListener("block", (event) => {
  const block = JSON.parse(event.data)
  console.log("Block", event.lastEventId, block)
})

eventSource.addEventListener("ping", (event) => {
  console.log("Keep-alive ping")
})
Resume from specific block
curl -N "https://live.near.tools?from_height=170727400"

Features

Real-time streaming

Server-Sent Events endpoint for live NEAR block data as blocks are finalized.

Automatic catch-up

Resume from any block height with built-in ring buffer for fast catch-up.

Finality guarantee

Only streams finalized blocks, ensuring data consistency and reliability.

Batch processing

Efficiently handles multiple new blocks per poll with smart batching.

Production-ready

Built for reliability with exponential backoff, retries, and structured logging.

Self-hostable

Open source and easy to deploy with Docker or build from source.

API Documentation

GET /

Server-Sent Events endpoint for real-time block streaming.

Query Parameters

from_height (optional) - Resume stream from block height (exclusive)

Event Format

event: block
id: 170727400
data: {"block_height":170727400,"block_hash":"...","prev_block_hash":"...",...}

event: block
id: 170727401
data: {"block_height":170727401,...}

GET /healthz

Health check endpoint. Returns "ok" as JSON.

Self-Hosting

Docker
docker pull ghcr.io/r-near/near-stream:latest

docker run -d \
  -p 8080:8080 \
  -e RUST_LOG=info \
  ghcr.io/r-near/near-stream:latest
Build from source
cargo build --release
RUST_LOG=info cargo run --release