← Buidl
Mining Control API

Control an Orestack miner from your bot

Pause, start, and change strategy for a miner you already created in the Orestack app. Private keys stay on your machine. Orestack keeps cranking deploys.

Prerequisite. Create and fund a miner on /mine first. This API will not onboard, deposit, claim, or deploy.

What you can do

ActionHowNotes
Pause POST /api/v1/mining/{manager}/pause Off-chain challenge signature — no SOL fee
Start (resume) POST /api/v1/mining/{manager}/resume Same auth; crank can deploy again next eligible round
Change strategy POST /api/v1/mining/{manager}/strategy then on-chain tx API validates; your bot signs updateStratDeployer on your RPC
Config / state GET .../config, GET .../{manager}/state Public reads (state is rate-limited)

Base URL

https://orestack.app

OpenAPI: https://orestack.app/api/v1/mining/openapi.json.

Identity

Eligibility

Mutations require an on-chain StrategyDeployer whose deploy_authority is the Orestack executor. Otherwise the API returns 403 not_orestack_miner.

Authentication

  1. POST /api/v1/mining/auth/challenge with { pubkey, manager, action }
  2. Sign the action message with the authority keypair
  3. POST the mutation with { signature, message, pubkey }

Signed messages

ActionMessage
pause / resume{action}:{manager}:{nonce}
set-strategyset-strategy:{manager}:{nonce}:{strategy_type}:{strategy_data_hash}:{expected_bps_fee}:{expected_flat_fee}:{max_per_round}

strategy_data_hash is hex(sha256) of the exact 64-byte strategy_data blob. Fee ceilings in the message must match the request body. The old JSON-hash-only form is rejected (#609).

SDK (recommended)

Official package @orestack/mining. It loads a local keypair, handles challenges, and submits strategy transactions on your RPC.

import { OrestackMining, KeypairSigner } from '@orestack/mining'

const api = new OrestackMining({
  backendUrl: process.env.ORESTACK_API!,
  rpcUrl: process.env.RPC_URL!,
  signer: KeypairSigner.fromFile(process.env.AUTHORITY_KEYPAIR!),
  manager: process.env.MANAGER_PUBKEY!,
})

await api.pause()
await api.resume()
// await api.setStrategy(...) — validates via HTTP, then signs on-chain

Env vars

VariablePurpose
ORESTACK_APIBackend base URL
RPC_URLYour Solana RPC (strategy txs only)
AUTHORITY_KEYPAIRPath to Solana JSON keypair file (mode 0600)
MANAGER_PUBKEYManager account — not Auth PDA

Not in this API

Also useful