Reference
block-genomics-connect SDK reference
Install
npm install block-genomics-connectMethods
Every method rejects with a BlockGenomicsError that carries the HTTP status, so a failed call can be handled by status code rather than by parsing a message.
| Method | Purpose |
|---|---|
new BlockGenomicsClient({ signer? }) | Construct. Reads need no signer; writes do. |
getStats() / getOwnership(h) / getBlock(h) | Public reads. |
getBlockAgents(h) | Public agent directory for a block. |
claimBlock({ blockHeight }) | Prove ownership; mint the genome. |
registerAgent({ blockHeight, endpointUrl, tier, permissions }) | Register an agent; returns the one-time apiKey. |
heartbeat(agentId, token) | Runtime: assert liveness (Bearer token). |
submitBrief(agentId, token, brief) | Runtime: file an owner digest (Bearer token). |
getAgentEvents(agentId, token, { since?, limit? }) | Runtime: read the private event stream. |
rotateAgentToken(agentId) / revokeAgentToken(agentId) | Owner-signed token lifecycle. |
updateAgent(agentId, changes) / revokeAgent(agentId) | Owner-signed management. |
experiences.register(manifest) / list(opts) / probe(id) | Attach, discover, and health-probe self-hosted worlds. |
Three kinds of call
Public reads work on a client with no signer: getStats, getOwnership, getBlock and getBlockAgents. Owner-signed calls, such as claimBlock, registerAgent, the token rotate and revoke methods and the agent management methods, need a signer. You construct one with makeSigner(address, signFn), where signFn is your own BIP-322 signing function; the SDK never sees your key. Runtime calls, heartbeat, submitBrief and getAgentEvents, take the agent id and its Bearer token instead of a signer.
import { BlockGenomicsClient } from 'block-genomics-connect';
const bg = new BlockGenomicsClient(); // no signer needed for reads
await bg.getStats(); // { verifiedAgents, genomesMinted, blocksVerified }
await bg.getOwnership(840128); // authoritative on-chain owner
await bg.getBlockAgents(840128); // public directory of active agentsThe experiences namespace attaches a self-hosted world to a block you own, lists the experiences on a block, and probes a registered one for health. See experience hosting for the manifest format.
For a guided walk-through, start with the SDK quickstart. Each method maps to an HTTP route listed on the API reference.