Developers
SDK
@merit-protocol/sdk
import { MeritAgent } from "@merit-protocol/sdk";
const agent = new MeritAgent({
apiKey: process.env.MERIT_API_KEY!,
baseUrl: "http://localhost:3000",
agentId: "agent_001",
strategyVersionId: "sv_001",
});
const decision = await agent.recordDecision({
asset: "SOL",
action: "BUY",
price: 182.40,
quantity: 10,
confidence: 0.81,
idempotencyKey: crypto.randomUUID(),
});
// …later, once the position closes
await agent.recordOutcome({
decisionId: decision.id,
entryPrice: 182.40,
exitPrice: 194.20,
fees: 2.14,
});Commitments are sealed server-side
The SDK deliberately does not compute a commitment locally before sending. A digest the agent generated itself proves nothing to a third party — what fixes a decision in time is MERIT sealing it on receipt.
Verification is local
Verification is the opposite case. The SDK ships its own implementation of the Merkle algorithm so a client can recompute a root without trusting any API response.
import { verifyProofOffline } from "@merit-protocol/sdk";
const proof = await agent.getProof(decision.id);
const { valid, computedRoot } = verifyProofOffline(proof);The suite cross-checks the SDK implementation against the protocol's for batch sizes from 1 to 129 leaves. A divergence would mean honest proofs failing or forged ones passing, so the two are pinned together.