Watching events (NATS)
Connect with any NATS client to:- TCP:
nats://<host>:50010(default = HTTP port + 10) - WebSocket:
ws://<host>:50020(HTTP port + 20, no TLS)
bloodv3.
Each message is a protobuf blood.events.v1.Event defined in proto/blood/events/v1/events.proto, with one of:
Generate language bindings from the
.proto (buf generate or protoc). Timestamps use created_at_nanos (Unix nanoseconds).
When the bot is exposed beyond localhost, NATS expects username/password (see Build on BLOOD connection table).
Recipes
Ideas thebuild-on-blood skill is meant to help you (or an AI) implement:
Working rules
Follow these whenever you or an AI write against the API:- Read before write. Call
GET /state,GET /wallets/,GET /tasks/first, and use real ids from the responses. Never invent wallet, group, or preset ids. - Dry-run first. Prefer the smallest amount on the chosen wallet, and show the exact request JSON before sending anything that trades.
- Handle failure. Treat non-2xx responses as failures and surface
error. Do not retry/trade/or/feedblindly — a timeout does not mean the call did not execute. CheckGET /positions/or the event stream first. - Timeouts. The server times out at 30s. Set client timeouts a little above that for trades.
- Secrets. Keys, license, and node credentials come from env vars or a secrets manager. Do not commit them. Wallet creation (
POST /wallets/) takes aprivate_key— send it only over localhost or a private tunnel. - API stability. The API is versioned
v1(spec version0.0.1). Pin to the bot version you tested against and re-read the OpenAPI spec after updating BLOOD. - Stay in scope. Do not build tools that bypass BLOOD’s licensing, or that expose a user’s bot to the public internet.
Related pages
- Build on BLOOD — skill install + connection
- API flows — endpoints and trade / task / feed calls
- API Getting Started — base URL
- VPS Setup — running remotely
- Positions (GUI) / Positions (CLI)
