Reference
Node vs browser
One package, two writing paths. Everything that reads the chain runs anywhere; signing is either backend keys or the Hive Keychain extension.
Matrix
| Feature | Node / workers | Browser | Notes |
|---|---|---|---|
| hive.rpc | Yes | Yes | fetch only |
| hive.beacon | Yes | Yes | Node discovery |
| hive.reader.transaction() | Yes | Yes | Read by id |
| hive.blocks.watch() | Yes | Yes | Async generator |
| hive.customJson.watch() | Yes | Yes | Async generator |
| hive.payments.watch() | Yes | Yes | Async generator |
| hive.payments.validate() | Yes | Yes | Read-only |
| hive.builder / hive.parser | Yes | Yes | Pure functions |
| hive.keychain | No | Yes | KEYCHAIN_UNAVAILABLE elsewhere |
| hive.keychainIssuer | No | Yes | KEYCHAIN_UNAVAILABLE elsewhere |
| hive.issuer | Yes | No | Backend only — reads key env vars |
Security
Backend issuing reads private keys from environment variables. Never bundle a configuration with
keyEnv into browser code — use hive.keychainIssuer there.Runtimes
Node 18+, Bun, Deno, Cloudflare Workers and every modern browser are supported. The SDK uses global fetch, reads process.env only through a guarded resolver, and touches no DOM API at module scope, so importing it during server rendering is safe.
TypeScript
// Browser-only calls fail predictably instead of throwing ReferenceError.
try {
await hive.keychain.customJson({ username: "alice", id: "my-app", action: "claim" });
} catch (error) {
// error.code === "KEYCHAIN_UNAVAILABLE" on the server
}Package shape
ESM only, one entry point (hivexph-sdk), bundled type declarations, no side effects on import: constructing a client opens no connection and starts no stream.
