Skip to content

Connect to a Stack

This page shows how to add Hyperstack to an existing project and connect to a deployed stack. It uses the public ORE mining stack as the example — no account or API key required.


Terminal window
npm install hyperstack-react zustand
App.tsx
import { HyperstackProvider, useHyperstack } from "hyperstack-react";
import { ORE_STREAM_STACK } from "hyperstack-stacks/ore";
function OreRounds() {
const { views, isConnected } = useHyperstack(ORE_STREAM_STACK);
const { data: rounds, isLoading } = views.OreRound.latest.use({
take: 5,
});
if (isLoading) return <div>Connecting...</div>;
return (
<div>
<h1>Live ORE Mining Rounds {isConnected && "🟢"}</h1>
{rounds?.map((round) => (
<div key={round.id?.round_id}>
Round #{round.id?.round_id} — Motherlode: {round.state?.motherlode}
</div>
))}
</div>
);
}
export default function App() {
return (
<HyperstackProvider websocketUrl="wss://ore.stack.usehyperstack.com">
<OreRounds />
</HyperstackProvider>
);
}
Terminal window
npm run dev

You connected to a deployed Hyperstack stack. The ORE stack watches the Solana blockchain, extracts round data from on-chain transactions, and pushes typed updates to your app via WebSocket as they happen — no polling, no RPC calls, no indexer to run.

1

Solana

ORE program on-chain

2

Hyperstack

ORE stack (deployed)

3

Your App

Typed live stream

The stack is public — just point your SDK at the WebSocket URL.


A stack SDK tells the Hyperstack client what entities and views are available, and provides the types for each. There are two ways to get one:

Pre-built for publicly deployed stacks (like ORE) — We publish ready-to-use SDKs for both TypeScript and Rust:

Terminal window
# TypeScript / React
npm install hyperstack-stacks
import { ORE_STREAM_STACK } from "hyperstack-stacks/ore";
# Rust — add to Cargo.toml
[dependencies]
hyperstack-stacks = "0.5.3"
use hyperstack_stacks::ore::{OreStack, OreRound};

Generated from your own stack — When you build a custom stack, use the CLI to generate an SDK for any language:

Terminal window
hs sdk create typescript my-stack
hs sdk create rust my-stack

Both approaches produce the same result: a typed SDK that works identically with the Hyperstack client.


StackWebSocket URLData
ORE Mining Roundswss://ore.stack.usehyperstack.comLive ORE mining round updates

Each OreRound update has this structure:

{
"id": {
"round_id": 142857,
"round_address": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU"
},
"state": {
"expires_at": 312645000,
"motherlode": 5000000000,
"total_deployed": 125000000000,
"total_vaulted": 12500000000,
"total_winnings": 98500000000
},
"results": {
"top_miner": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"top_miner_reward": 2500000000,
"winning_square": 18,
"did_hit_motherlode": false
},
"metrics": {
"deploy_count": 1847,
"total_deployed_sol": 125000000000,
"checkpoint_count": 423
}
}
SectionDescription
idPrimary key (round_id) and lookup index (round_address)
stateCurrent round state from on-chain account
resultsRound outcome including computed fields
metricsAggregated counts and sums from instructions